1

I have added an ImageView and two TextFields to my Layout but when I look in the preview it just stays blank. It gives me the error "Rendering error". What can I do?

I will add my Layout file in the following:

<?xml version="1.0" encoding="utf-8"?>
<RealtiveLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorSlide_1" >

<ImageView
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:src="@drawable/wireless"
    android:layout_centerHorizontal="true"
    android:scaleType="centerCrop"
    android:layout_marginTop="150dp"
    android:id="@+id/img"
    />

<TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="@string/slide_1_title"
    android:textColor="android:color/white"
    android:textSize="30sp"
    android:textStyle="bold"
    android:gravity="center_horizontal"
    android:layout_below="@+id/img"
    android:layout_marginTop="12dp"
    android:id="@+id/slide_title"
    />
<TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="@string/slide_1_desc"
    android:textColor="android:color/white"
    android:textSize="18sp"
    android:gravity="center_horizontal"
    android:layout_below="@id/slide_title"
    android:layout_marginTop="12dp"
    android:id="@+id/slide_desc"
    android:layout_marginRight="40sp"
    android:layout_marginLeft="40sp"
    />

</RealtiveLayout>
KeLiuyue
  • 8,149
  • 4
  • 25
  • 42
MIsterX
  • 31
  • 6
  • @NileshRathod Because i have not worked with Android Studio yet I Need to know where I can do this? – MIsterX Sep 16 '17 at 12:51

2 Answers2

1

Change RealtiveLayout to RelativeLayout in your root Layout.

KeLiuyue
  • 8,149
  • 4
  • 25
  • 42
1

Check this below changes:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorSlide_1"
>

<ImageView
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:src="@drawable/wireless"
    android:layout_centerHorizontal="true"
    android:scaleType="centerCrop"
    android:layout_marginTop="150dp"
    android:id="@+id/img"
    />

<TextView
    android:layout_width="match_parent"
    android:layout_height="45dp"//or you use wrap_content
    android:text="@string/slide_1_title"
    android:textColor="android:color/white"
    android:textSize="30sp"
    android:textStyle="bold"
    android:gravity="center_horizontal"
    android:layout_below="@+id/img"
    android:layout_marginTop="12dp"
    android:id="@+id/slide_title"
    />
<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/slide_1_desc"
    android:textColor="android:color/white"
    android:textSize="18sp"
    android:gravity="center_horizontal"
    android:layout_below="@id/slide_title"
    android:layout_marginTop="12dp"
    android:id="@+id/slide_desc"
    android:layout_marginRight="40sp"
    android:layout_marginLeft="40sp"
    />

</RelativeLayout>
Viswa Sundhar
  • 121
  • 3
  • 16
  • Can you help me a second time? When I start this application it gives me an error with the line: Android:textColor="Android:color/White How can I solve this? – MIsterX Sep 16 '17 at 14:11
  • use like this android:textColor="@android:color/white" ... If you stored in color file of your project then you use as android:textColor="@color/white" – Viswa Sundhar Sep 16 '17 at 14:14