-2

Helo All,

I am stuck in an error regarding circular dependencies for Relative Layout. Could anyone help me where I went wrong? I am using multiple activity xmls but the error is occuring when 1st activity is being executed.

Here is my Relative layout code :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5fb0c9"
android:orientation="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true">

<TextView
    android:id="@+id/login_title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="16dp"
    android:layout_marginTop="22dp"
    android:gravity="center_horizontal"
    android:text="Account Login"
    android:textColor="#fff"
    android:textSize="26sp"
    android:textStyle="bold" />

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/login_title"
    android:layout_marginLeft="30dp"
    android:layout_marginRight="30dp"
    android:layout_marginTop="70dp"
    android:background="#fff"
    android:elevation="4dp"
    android:orientation="vertical"
    android:padding="20dp"
    android:id="@+id/relativeLayout">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="30dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentTop="true"
        android:weightSum="1">


        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/editText_username"
            android:layout_gravity="center_horizontal"
            android:layout_weight="0.14"
            android:hint="USER NAME"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/editText_location"
            android:layout_weight="0.17"
            android:hint="LOCATION"/>

        <Button
            android:id="@+id/user_confirm"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="22dp"
            android:background="#d67601"
            android:text="CONFIRM"
            android:textAllCaps="false"
            android:textColor="#fff"
            android:textSize="18sp" />
    </LinearLayout>
</RelativeLayout>

<ImageButton
    android:id="@+id/user_profile_photo"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:background="@drawable/user_profile_image_background"
    android:elevation="6dp"
    android:src="@drawable/pro"
    android:layout_below="@+id/login_title"
    android:layout_centerHorizontal="true" />

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/images"
    android:orientation="vertical"
    android:scrollbarAlwaysDrawVerticalTrack="true">

    <Button
        android:id ="@+id/node_scan"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="NODE SCAN"
        android:onClick="Scan"
        android:background="@drawable/button_bg_rounded_corners"
        android:padding="15dp"
        android:shadowColor="#ffffff"
        android:textColor="#ffffff"
        android:layout_marginTop="105dp"
        android:layout_below="@+id/contents"
        android:layout_alignParentEnd="true"
        android:layout_alignParentStart="true" />

    <Button
        android:id ="@+id/post"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="POST"
        android:onClick="post"
        android:background="@drawable/button_bg_rounded_corners"
        android:padding="15dp"
        android:shadowColor="#ffffff"
        android:textColor="#ffffff"
        android:layout_alignTop="@+id/next"
        android:layout_alignParentEnd="true" />
    <Button
        android:id ="@+id/next"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="NEXT"
        android:onClick="next"
        android:background="@drawable/button_bg_rounded_corners"
        android:padding="15dp"
        android:shadowColor="#ffffff"
        android:textColor="#ffffff"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="73dp" />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/contents"
        android:layout_gravity="center_horizontal"
        android:layout_weight="0.14"
        android:hint=""
        android:background="#fcfbfb"
        android:layout_alignParentStart="true"
        android:layout_above="@+id/post"
        android:layout_below="@+id/node_scan" />
    <Button
        android:id ="@+id/quit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="QUIT"
        android:onClick="quit"
        android:background="@drawable/button_bg_rounded_corners"
        android:padding="15dp"
        android:shadowColor="#ffffff"
        android:textColor="#ffffff"
        android:layout_alignTop="@+id/post"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

Thanks in Advance, Alby

Alby
  • 23
  • 1
  • 6
  • 1
    Possible duplicate of [Circular dependencies cannot exist in RelativeLayout, android?](http://stackoverflow.com/questions/23904281/circular-dependencies-cannot-exist-in-relativelayout-android) – Harshad Pansuriya Jul 07 '16 at 08:56

2 Answers2

0
android:layout_below="@+id/login_title"

Here should be "@id/..." (whithout a plus sign), because it is a reference to an existing ID. https://developer.android.com/guide/topics/ui/declaring-layout.html#id

Dmitry T.
  • 673
  • 7
  • 7
0

The error was fixed after removing the below from Edit Text field: android:layout_above="@+id/post" android:layout_below="@+id/node_scan"

Alby
  • 23
  • 1
  • 6