【发布时间】:2015-02-23 07:29:32
【问题描述】:
我编写的这个 xml 文件保存时没有错误,并在 eclipse 的预览中准确地显示了我期望它的样子。但是如果有足够的时间(大约 5-10 分钟),在继续处理项目的其他部分(如实际的 Java 文件)后,此文件会引发错误。
它在抱怨,因为我正在锚定在 xml 文件中进一步声明的视图上。但我无法解决这个问题,因为所有 3 个主要部分都相互依赖。如果我改变它,它看起来一点也不好看。
我该如何解决这个问题?
<!-- The chat bubble -->
<RelativeLayout
android:id="@+id/chat_bubble_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<!-- The user's name above the chat bubble -->
<TextView
android:id="@+id/chat_bubble_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/chat_bubble_comment" ERROR HERE!!!!
android:layout_marginLeft="9dip"
android:textSize="12sp"
android:text="Username"
android:textColor="#88000000">
</TextView>
<TextView
android:id="@+id/chat_bubble_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/chat_bubble_username"
android:layout_toRightOf="@id/chat_bubble_profile_picture"
android:layout_margin="5dip"
android:background="@drawable/bubble_yellow"
android:paddingLeft="4dp"
android:text="Hello bubbles!"
android:textColor="@android:color/primary_text_light" />
<!-- The user's profile picture next to the chat bubble -->
<ImageView
android:id="@+id/chat_bubble_profile_picture"
android:layout_marginLeft="10dip"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#000000"
android:layout_alignTop="@id/chat_bubble_comment"
/>
</RelativeLayout>
【问题讨论】: