Circular dependencies cannot exist in RelativeLayout, android?

Deadly 提交于 2019-11-26 22:32:40
Soumil Deshpande

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

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.

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

Enclose your scroll view within a Relative Layout.

The structure will be:

<RelativeLayout
......
....
.....>

<RelativeLayout
.....
.....
.....>

<ScrollView
....
...
...>

put your staff here

</ScrollView>
</RelativeLayout>


<RelativeLayout
....
....
below the above relative layout
...../>

<Button
....
....
..../>

</RelativeLayout>

</RelativeLayout>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!