- <?xml version=“1.0” encoding=”utf-8″?>
- <ScrollView xmlns:android=“http://schemas.android.com/apk/res/android”
- android:layout_width=“fill_parent”
- android:layout_height=“wrap_content” >
- <HorizontalScrollView
- android:layout_width=“fill_parent”
- android:layout_height=“wrap_content” >
- <RelativeLayout
- android:layout_width=“fill_parent”
- android:layout_height=“fill_parent”>
- <TextView
- android:id=“@+id/textview1”
- android:layout_width=“wrap_content”
- android:layout_height=“wrap_content”
- android:text=“Scrolling view”
- android:textSize=“30dp” />
- <ImageView
- android:id=“@+id/imageview1”
- android:layout_width=“wrap_content”
- android:layout_height=“wrap_content”
- android:layout_toRightOf=“@id/textview1”
- android:src=“@drawable/item1” />
- <TextView
- android:id=“@+id/textview2”
- android:layout_width=“wrap_content”
- android:layout_height=“wrap_content”
- android:layout_toRightOf=“@id/imageview1”
- android:text=“Vertical and horizontal scrolling”
- android:textSize=“30dp” />
- <ImageView
- <span style=“color:#ff6666;”>android:id=”@+id/imageview2″
- </span> android:layout_width=“wrap_content”
- android:layout_height=“wrap_content”
- android:layout_below=“@id/textview1”
- android:src=“@drawable/item2” />
- <TextView
- android:id=“@+id/textview3”
- android:layout_width=“wrap_content”
- android:layout_height=“wrap_content”
- android:layout_below=“@id/imageview2”
- android:text=“Vertical and horizontal scrolling”
- android:textSize=“30dp” />
- <ImageView
- <span style=“color:#ff6666;”> android:id=”@+id/imageview2″</span>
- android:layout_width=“wrap_content”
- android:layout_height=“wrap_content”
- android:layout_below=“@id/textview3”
- android:src=“@drawable/item3” />
- </RelativeLayout>
- </HorizontalScrollView>
- </ScrollView>
Such an exception broke out, java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout.
The reason is that duplicate view ID names are reproduced in the RelativeLayout layout, and imageview2, textview3, and imageview2 have circular dependencies.
Solution: Modify the id of the last ImageView to imageview3. Avoid the control cycle dependency in RelativeLayout.
The essence is: the position of 1 depends on the position relative to 2 and 2 depends on the position relative to 1, but the two relative positions are contradictory.
Similar Posts:
- Eclipse’s shortcut Ctrl + Shift + F doesn’t work
- Android Your content must have a ListView whose…
- [Solved] android.view.InflateException: Binary XML file line #0: Error inflating class ImageView
- Warning: Each child in an array or iterator should have a unique “key” prop. Check the render method
- [Solved] Android Warning: android.content.res.Resources$NotFoundException: Resource ID #0x7f08010a
- Circular dependencies cannot exist in RelativeLayo
- [Solved] echart Error: Can’t get dom width or height
- Error:This Activity already has an action bar supplied by the window decor.
- Ffmpeg scaling — the solution of “width / height not divisible by 2”
- Elimination of warning message “nested weights are bad for performance”