我的布局是要一个表格, 共4个格子(2行2列), 每格需求宽度不一样, 高度一样.
占屏宽比例: 1格占40%, 2格占60%,  3格占20%,4格占80%.
以下的代码不能达效果, 麻烦各位大侠帮助.//java
TextView tv1 = (TextView)findViewById(R.id.tv1);
TextView tv2 = (TextView)findViewById(R.id.tv2);
TextView tv3 = (TextView)findViewById(R.id.tv3);
TextView tv4 = (TextView)findViewById(R.id.tv4); Display display = this.getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int hight = display.getHeight();
tv1.setWidth((int) ((width)*0.4));
tv2.setWidth((int) ((width)*0.6)); tv3.setWidth((int) ((width)*0.2));
tv3.setWidth((int) ((width)*0.8)); tv1.setHeight((int) ((hight)*0.25));
tv2.setHeight((int) ((hight)*0.25));
tv3.setHeight((int) ((hight)*0.25));
tv4.setHeight((int) ((hight)*0.25));//xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout001"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="bottom|center_horizontal"
    android:orientation="horizontal" >    <TableLayout
        android:id="@+id/tableLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#000000"
        android:orientation="horizontal" >        <TableRow>            <TextView
                android:id="@+id/tv1"
                android:layout_margin="2dip"
                android:background="#00FA9A"
                android:gravity="right"
                android:text="T1"
                android:textColor="#0000FF"
                android:textSize="38sp"
                android:textStyle="bold"/>            <TextView
                android:id="@+id/tv2"
                android:layout_margin="2dip"
                android:background="#00FA9A"
                android:gravity="center"
                android:text="T2"
                android:textColor="#0000FF"
                android:textSize="30sp"
                android:textStyle="bold" />
        </TableRow>        <TableRow>            <TextView
                android:id="@+id/tv3"
                android:layout_margin="2dip"
                android:background="#00FFFF"
                android:gravity="right"
                android:text="T3"
                android:textColor="#000000"
                android:textSize="30sp"
                android:textStyle="bold"/>            <TextView
                android:id="@+id/tv4"
                android:layout_margin="2dip"
                android:background="#FFFFFF"
                android:gravity="center"
                android:text="T4"
                android:textColor="#000000"
                android:textSize="30sp"
                android:textStyle="bold" />
        </TableRow>    </TableLayout></LinearLayout>layout