我试图让 ListView 行如下所示:
| Text-Text-Text <ImageButton> |
图像按钮对齐到右边缘。我怎样才能做到这一点?这是我正在使用的当前布局代码。我究竟做错了什么?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layercontainer"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#699">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="left">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="YO HOW SI IT GOESSDA" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="right">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/trash" />
</LinearLayout>
</LinearLayout>
My code currently produces this:
步骤#1:使用RelativeLayout
base.
步骤#2:把你的ImageButton
作为有android:layout_alignParentRight="true"
步骤#3:把你的TextView
有 有android:layout_alignParentLeft="true"
, android:layout_toLeftOf="..."
(where ...
是您的 IDImageButton
),也许还有其他一些RelativeLayout.LayoutParams
垂直对齐值
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)