android:layout_width=";包装“U内容”;在相对论中不起作用
回答并断言,android:layout_width=";包装“U内容”;在相对论中不起作用,android,android-layout,Android,Android Layout,回答并断言,android:layout\u alignParent*属性在RelativeLayout和子视图之间创建循环引用。但是,给定一个没有任何android:layout\u alignParent*属性的简单布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout
android:layout\u alignParent*
属性在RelativeLayout和子视图之间创建循环引用。但是,给定一个没有任何android:layout\u 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
发生了什么事?显然,ListView项目的
布局\u宽度
会自动更改为匹配\u父项
。上面的布局在ListView之外工作