开发者

"Found cyclical <include> chain" error in XML layout file

I am creating a XML layout for my activity - let's call it layout_a.xml - which looks like:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <include layout="@layout/layout_b"/>
    <include layout="@layout/layout_b"/>
</LinearLayout>

Here is layout_b.xml:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/place_details_list_entry_checkins_history_user_avatar"
        android:layout_width="34dip"
        android:layout_height="34dip"
        android:src="@drawable/icn_profilepic_medium"
        android:scaleType="centerCrop"/>
    <ImageView
        android:id="@+id/place_details_list_entry_checkins_history_user_avatar_pro开发者_JAVA技巧vider_icon"
        android:layout_gravity="bottom|left"
        android:src="@drawable/icn_fb_small"
        android:layout_width="11dip"
        android:layout_height="11dip"/>
</FrameLayout>`

I get this error in Eclipse:

Found cyclical <include> chain: layout_a=>layout_b

Does anybody have a hint on what is causing it?


Sounds like a bug in ADT, please file a bug at http://b.android.com so that the Dev Tools team can look at it.


You have two includes of the same file in layout_a. Remove one of them if you don't need it and it's there by mistake. If it's on purpose I'm not sure if you can do that.


Does the error go away if you give each include a unique @+id?


I got the same issue and fixed it by removing the tools:layout="@layout/activity_customer_details"

Not sure if this is a good practice. But it worked on both app and the IDE.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜