Circular dependencies cannot exist in RelativeLayout, android?

前端 未结 4 1096
Happy的楠姐
Happy的楠姐 2020-11-28 10:59

I have the following layout: I need to keep the button at the bottom of screen and it should be visible to the user. The rest of the layout should scroll.

          


        
相关标签:
4条回答
  • 2020-11-28 11:23

    Add android:layout_alignParentTop="true" in your scrollView and delete android:layout_below="@+id/scrollView1" in the bottomLinearLayout.

    0 讨论(0)
  • 2020-11-28 11:23

    If you give both view each other android:layout_below id then this circular dependencies problem occur. for example

    <TextView
            android:id="@+id/tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Example Series"
            android:layout_below="@+id/rv_qpl"/>
    
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_qpl"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/tv"/>
    
    0 讨论(0)
  • 2020-11-28 11:24

    You cannot say the bottomLinearLayout is below scrollView1 then say scrollView1 is above bottomLinearLayout. Only do one, not both.

    This is circular because it will try to position itself after it figures out where the other one is at... Which is waiting on the first one.

    0 讨论(0)
  • 2020-11-28 11:36

    The problem is caused because there is a circular reference in the layout parameters.

    For example, when view B is layout_below view A, view A can't reference view B anymore in it's below, alignRight etc. This can also exist between multiple views: A references B references C. In that scenario C can't reference A because of a circular dependency.

    You Used :-

    bottomLinearLayout is below scrollView1 And then you said that scrollView1 is above bottomLinearLayout

    It dosen't work like that. Use one

    0 讨论(0)
提交回复
热议问题