androidandroid-studiowidgetandroid-relativelayoutmissing-features

Android studio widgets get disappeared in Relative layout


Why does relative layout makes my widgets disappear. Whenever I am adding edit text in the code, everything dissappears.

 <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".userconfirmation">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="120dp"
        android:layout_height="150dp"
        android:layout_marginTop="40dp"
        app:srcCompat="@drawable/ic_house"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="70dp"
        android:layout_centerInParent="true"
        android:layout_above="@+id/editTextemail"
        android:text="Login"
        android:textColor="@color/black"
        android:textSize="30sp" />


    <EditText
        android:id="@+id/editTextemail"
        android:layout_width="250dp"
        android:layout_height="40dp"
        android:ems="10"
        android:hint="Email"
        android:inputType="textPersonName"
        android:textSize="16dp"
        android:background="@color/light_grey"
        android:layout_marginBottom="35dp"
        android:layout_below="@+id/textView"
        android:layout_centerHorizontal="true" />



</RelativeLayout>

When I am adding this widgets, in relative layout, they suddenly get disappeared. What is the reason?


Solution

  • Just remove the following line, from TextView attributes

    android:layout_above="@+id/editTextemail"