当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Circular Dependencies in XML file

问题描述:

This question already has an answer here:

  • Why am I getting a CircularDependencyException?

    3 answers

网友答案:

You have defined your title to be above your subtitle, and your subtitle to be below your title:

<TextView android:id="@+id/title" ... android:layout_above="@+id/subtitle" ... />
<TextView android:id="@+id/subtitle" ... android:layout_below="@+id/title" ... />

That's a circular reference: To position title, Android first needs to determine the position of subtitle. However, to position subtitle, it needs to determine the position of title first.

You need to make sure that Android can position your elements without getting into a depencendy loop. For example, positioning the title at the top, and then positioning the subtitle below the title would be fine.

分享给朋友:
您可能感兴趣的文章:
随机阅读: