1
这是我的TableLayout代码:的Android TableLayout - 文本视图和按钮同一列内
<TableLayout
android:layout_width="1200dp"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="40dp" >
<TableRow>
<TextView
\t android:text="ADDRESS"
android:background="@drawable/cell_shape"
android:textColor="@color/white"
android:layout_weight="1"
style="TableTitle" />
<TextView
android:text="TENANCY"
android:background="@drawable/cell_shape"
android:textColor="@color/white"
android:layout_weight="1"
\t style="TableTitle" />
<TextView
android:text="LOCATION"
android:background="@drawable/cell_shape"
android:textColor="@color/white"
android:layout_weight="5"
\t style="TableTitle" />
<TextView
android:text="NAME"
android:background="@drawable/cell_shape"
android:textColor="@color/white"
android:layout_weight="1"
\t style="TableTitle" />
<TextView
android:text="SELECTION"
android:background="@drawable/cell_shape"
android:textColor="@color/white"
android:layout_weight="1"
\t \t \t style="TableTitle" />
</TableRow>
然后我绘制/ cell_shape如下:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape= "rectangle"
android:name="@+id/rec1" >
<solid android:color="#30383F"
android:padding="10dp" />
<scale
android:scaleHeight="200"
android:scaleWidth="200" />
<stroke
android:width="1dp"
android:color="#D9D9D6" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
我可以设置表格,但是我的问题是我能够在文本视图右侧的列中添加一个按钮。这可能吗?
例如,在第一列中,我希望它说“地址”,然后向右几个像素,因为那里有一个按钮,全部在同一列内。谢谢你的帮助 !
这个工作的按钮和文本!感谢那。欣赏它:) – Will 2015-03-20 05:37:56
我想你的答案,但我没有足够的代表,请记住我的问题? – Will 2015-03-20 05:38:26
完成你:) – 2015-03-20 05:42:27