我想要有一個Tablelayout以下屬性,android tableLayout列色問題
1.我想改變列的背景顏色。現在,如果我爲TextView設置背景,它將封裝內容並將該顏色設置爲不是整列。我想爲我的兩列添加不同的顏色。
2.更改兩列之間的空間(可能是邊框)。
有人做過這樣的事情請幫幫我。由於
<TableLayout
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:layout_margin="2dip"
android:orientation="vertical" >
<TableRow
android:padding="3dip"
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/NameLabel"
android:textColor="@color/black"
android:textSize="20sp"
android:background="#1DA43F"/>
<TextView
android:layout_marginLeft="5dip"
android:id="@+id/NameText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAlignment="center"
android:layout_gravity="left"
android:text="@string/NameLabel"
android:background="@color/DarkRed"
android:textSize="20sp"/>
</TableRow></TableLayout>
向我們展示你當前的代碼。 –
已更新代碼... –
當您說'我應該能夠更改'時,您是指動態還是XML? –