android 学习

weight属性

wrap_content和match_parent

 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
 2     xmlns:tools="http://schemas.android.com/tools"    
 3     android:id="@+id/LinearLayout1"    
 4     android:layout_width="match_parent"    
 5     android:layout_height="match_parent"  
 6     android:orientation="horizontal" >    
 7     
 8     <TextView    
 9         android:layout_weight="1"    
10         android:layout_width="wrap_content"    
11         android:layout_height="fill_parent"    
12         android:text="one"     
13         android:background="#98FB98"    
14      />    
15      <TextView    
16         android:layout_weight="2"    
17         android:layout_width="wrap_content"    
18         android:layout_height="fill_parent"    
19         android:text="two"     
20         android:background="#FFFF00"    
21      />    
22      <TextView    
23         android:layout_weight="3"    
24         android:layout_width="wrap_content"    
25         android:layout_height="fill_parent"    
26         android:text="three"     
27         android:background="#FF00FF"    
28      />    
29     
30 </LinearLayout>
原文地址:https://www.cnblogs.com/Nojava/p/14891968.html