【发布时间】:2014-06-01 12:43:29
【问题描述】:
答案here 和here 断言android:layout_alignParent* 属性会在RelativeLayout 和子视图之间创建循环引用。然而,给定一个简单的布局没有任何android:layout_alignParent*属性:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white"
>
<TextView
android:text="test text blah blah"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/holo_orange_dark"
android:textColor="@android:color/black"
/>
</RelativeLayout>
RelativeLayout 的布局宽度原来是 match_parent,而不是上面 XML 中指定的 wrap_content。
发生了什么事?
【问题讨论】: