Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android:layout_width=";包装“U内容”;在相对论中不起作用_Android_Android Layout - Fatal编程技术网

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之外工作