用layout_weight的時候,不要把寬度(或是高度,你想分配weight的那個)設成match_parent。html
android:layout_weight只適用於LinearLayoutandroid
android:layout_weight的真實含義是:一旦View設置了該屬性(假設有效的狀況下),那麼該 View的寬度等於原有寬度(android:layout_width)加上剩餘空間的佔比。.net
轉自:http://blog.csdn.net/yanzi1225627/article/details/24667299htm
看成爲父layout的LinearLayout的屬性爲androidrientation="vertical" 的時候,android:layout_gravity="?"這裏設爲橫向的時候才能生效。好比:left,right,center_horizontal等blog
看成爲父layout的LinearLayout的屬性爲androidrientation="horizental" 的時候,android:layout_gravity="?"這裏設爲縱向的時候才能生效。好比:top,bottom,center_vertical等;it
轉自:http://www.cnblogs.com/xiaoran1129/archive/2013/03/26/2982733.htmlio