我想把整个屏幕分成3个相等的部分,于是用到了 layout_weight 这个属性。。也的却可以。。但是。。我想要的是。。无论我在3个已分好的部分里写多少内容。。这3个大的部分的空间还是相等的。。不会因为某一个的内容多些就会挤压另外的部分的空间。这个要怎么实现呢?求解?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    android:orientation="vertical"  
    android:layout_width="fill_parent"  
    android:layout_height="fill_parent"  
    >
<TableLayout
    android:layout_width="fill_parent"  
    android:layout_height="fill_parent"    
>
    <TableRow 
    android:id="@+id/TableRow01" 
    android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="center_vertical">
          <LinearLayout android:id="@+id/artistDescLinearLayout"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_weight="1" 
  android:orientation="vertical"/>
     <LinearLayout android:id="@+id/artistDescLinearLayout"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_weight="1" 
  android:orientation="vertical"/>     <LinearLayout android:id="@+id/artistDescLinearLayout"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_weight="1" 
  android:orientation="vertical"/>
    </TableRow>
 
</TableLayout>
<LinearLayout>

解决方案 »

  1.   

    weight的意思是在各自资源占屏幕之后,如果有剩余空间,就平分
      

  2.   

    LinearLayout 里面不显示东东吗?显示的话,为啥不把显示数据的控件固定个宽不就OK了
      

  3.   

    楼主你不能使用LinearLayout  线性布局,, 如果你想固定点的话 可以使用 相对布局  希望可以帮助到你噢 。
      

  4.   

     android:layout_weight="3"改为“1”
      

  5.   

    用到weight的话,只能是relative。,如果不占用其他空间的资源的话,你可以吧控件的宽度写死单独
    用weight的话是实现不了你想的
      

  6.   

    直接写固定宽度。。如layout_width="100dip"