2016-07-07 45 views
-2

直升机所有,java.lang.IllegalStateException:循环依赖不能在RelativeLayout的

我被困在一个错误的方面相对布局循环依赖存在。任何人都可以帮助我,我哪里出错了? 我正在使用多个活动xmls,但第一个活动正在执行时发生错误。

这里是我的相对布局代码:

<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> 

由于事先 阿尔比

+0

完整的错误O/P: – Alby

+1

可能的重复[循环依赖不能存在于RelativeLayout,android?](http://stackoverflow.com/questions/23904281/circular-dependencies-cannot-exist-in-relativelayout-android) – Ironman

回答

0

错误固定从编辑文本字段除去以下之后:机器人:layout_above = “@ + ID /交” 机器人:layout_below = “@ + ID/node_scan”