<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:baselineAligned="false" > <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="#ff999999" android:orientation="vertical" > </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="#ff666666" android:orientation="vertical" > </LinearLayout> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:baselineAligned="false" > <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="#ffbbbbbb" android:orientation="vertical" > </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="#ffdddddd" android:orientation="vertical" > </LinearLayout> </LinearLayout> </LinearLayout> |
|
#1 |
这个样子,但是老是有“nested weights are bad for performance”提示,因为layout——weight 好像不提倡嵌套,可是这种布局不嵌套layout_weight 怎么搞?
|
40分
#2 |
TableLayout不行么
<?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:layout_column="2"> <TableRow android:layout_width="match_parent" android:layout_weight="1"> <TextView android:layout_weight="1" android:layout_height="match_parent" android:background="#ff0000"/> <TextView android:layout_weight="1" android:layout_height="match_parent" android:background="#00ff00"/> </TableRow> <TableRow android:layout_width="match_parent" android:layout_weight="1"> <TextView android:layout_weight="1" android:layout_height="match_parent" android:background="#0000ff"/> <TextView android:layout_weight="1" android:layout_height="match_parent" android:background="#e3e3e3"/> </TableRow> </TableLayout> |
#3 |
回复2楼:
这个样子,但是老是有“nested weights are bad for performance”提示,因为layout——weight 好像不提倡嵌套,可是这种布局不嵌套layout_weight 怎么搞?
O,只用 LinearLayout 和FrameLayout,忘了还有TableLayout,最外层换成 TableLayout 和TableRow后,提示就没有了。 |
#4 |
用相对布局不行吗新手
|