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>