假设我有一个布局 xml,如下所示:
表格布局
Row0: | textView_title (width=9) |
Row1: | ButtonX(width=3) | textView_describe (width=6) |
Row2: | ButtonY(width=3) | Button_back(width=3)| Button_start(width=3)|
水平合并可以使用跨度技术,就像下面的编码一样。我想问一下 ButtonX 和 ButtonY 可以合并吗?(即垂直?),如果没有,是否有任何方法可以制作这样的布局?
非常感谢!!
编码:
<?xml version="1.0" encoding="utf-8"?><TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*"
android:screenOrientation="landscape"
android:background="@drawable/blackboard" >
<TableRow
android:id="@+id/tableRow0"
android:layout_weight="0.2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textview_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:background="@drawable/transparent_btn"
android:gravity="center"
android:layout_span="9"
android:text="@string/title_number"
android:textColor="@color/white"
android:textSize="60dp" />
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_weight="0.5"
android:gravity="center" >
<Button
android:id="@+id/buttonX"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="3"
android:background="@drawable/transparent_btn"
android:text=""
android:textSize="30dp" />
<TextView
android:id="@+id/text_describe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="6"
android:background="@drawable/white_dot_btn"
android:gravity="top"
android:onClick="button_start_click"
android:text="abc"
android:textColor="@color/white"
android:textSize="20dp" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_weight="0.3"
android:gravity="center" >
<Button
android:id="@+id/buttonY"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="3"
android:background="@drawable/transparent_btn"
android:text=""
android:textSize="30dp" />
<Button
android:id="@+id/button_back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="3"
android:background="@drawable/white_btn"
android:text="quit"
android:onClick="button_back_click"
android:textSize="30dp" />
<Button
android:id="@+id/button_start"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_span="3"
android:background="@drawable/green_btn"
android:text="start"
android:onClick="button_start_click"
android:textSize="30dp" />
</TableRow>
</TableLayout>