用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