Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.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 复杂线性布局儿童定位和填充_Android_Xml - Fatal编程技术网

Android 复杂线性布局儿童定位和填充

Android 复杂线性布局儿童定位和填充,android,xml,Android,Xml,上面的代码是为了让您了解我正在尝试做什么。 我希望图像左侧、按钮右侧和文本视图填充中间的剩余空间。 如何定位按钮使其向右对齐并忽略文本视图宽度? 在文本视图上使用layout_weight=“1”。其他的将默认为0(意味着不向它们添加任何额外的空间) 完美!直到现在我才使用或理解重量,谢谢 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width

上面的代码是为了让您了解我正在尝试做什么。
我希望图像左侧、按钮右侧和文本视图填充中间的剩余空间。
如何定位按钮使其向右对齐并忽略文本视图宽度?

在文本视图上使用layout_weight=“1”。其他的将默认为0(意味着不向它们添加任何额外的空间)


完美!直到现在我才使用或理解重量,谢谢
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
    android:layout_width="fill_parent"
    android:layout_height="40.00dp">

 <ImageView
    android:layout_width="40.00dp"
    android:layout_height="40.00dp"
    android:background="@drawable/photo"/>

 <TextView
    android:layout_width="wrap_content"
    android:layout_height="40.00dp"
    android:textSize="14.00sp" />

 <Button
    android:layout_width="54.40dp"
    android:layout_height="22.40dp"
    android:background="@drawable/button"/>

 </LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="40.00dp">

    <ImageView
        android:layout_width="40.00dp"
        android:layout_height="40.00dp"
        android:background="@drawable/photo"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="40.00dp"
        android:layout_weight="1"
        android:textSize="14.00sp" />

    <Button
        android:layout_width="54.40dp"
        android:layout_height="22.40dp"
        android:background="@drawable/button"/>

</LinearLayout>