如何使用Android TableLayout创建跨多行的布局?
如何使用tablelayout创建以下布局?列跨越很简单,但我还没有找到任何关于行跨越的明确指导如何使用Android TableLayout创建跨多行的布局?,android,tablelayout,Android,Tablelayout,如何使用tablelayout创建以下布局?列跨越很简单,但我还没有找到任何关于行跨越的明确指导 试试这个。。。您可以使用layout_weight属性来实现您要执行的操作。。 下面的布局将具有上图所示的布局 <?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="verti
试试这个。。。您可以使用layout_weight属性来实现您要执行的操作。。 下面的布局将具有上图所示的布局
<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
<TableLayout android:layout_width="0dip"
android:layout_weight="2" android:layout_height="fill_parent">
<TableRow android:layout_width="0dip" android:layout_weight="2"
android:layout_height="0dip">
<View android:layout_width="0dip" android:layout_weight="1"
android:layout_margin="5dip" android:layout_height="fill_parent"
android:background="#fff"></View>
<View android:layout_width="0dip" android:layout_weight="1"
android:background="#eee" android:layout_margin="5dip"
android:layout_height="fill_parent"></View>
</TableRow>
<TableRow android:layout_width="0dip" android:layout_weight="2"
android:layout_height="0dip">
<View android:layout_width="0dip" android:layout_weight="1"
android:background="#eee" android:layout_height="fill_parent"
android:layout_margin="5dip"></View>
<View android:layout_width="0dip" android:layout_weight="1"
android:layout_margin="5dip" android:layout_height="fill_parent"
android:background="#fff"></View>
</TableRow>
</TableLayout>
<TableLayout android:layout_width="0dip"
android:layout_weight="1" android:layout_height="fill_parent">
<TableRow>
<View android:layout_width="0dip" android:layout_weight="1"
android:background="#bbb" android:layout_height="fill_parent"></View>
</TableRow>
</TableLayout>
</TableRow>
在上面的代码中,将视图替换为您想要的视图