Android-LinearLayout布局技巧(二)

先来看看图:

布局代码:

 1     <?xml version="1.0" encoding="utf-8"?>  
 2     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
 3         android:layout_width="match_parent"  
 4         android:layout_height="match_parent"  
 5         android:orientation="horizontal" >  
 6         <LinearLayout   
 7             android:layout_width="wrap_content"  
 8             android:layout_height="20dp"  
 9             android:background="@color/green_light"  
10             android:layout_weight="1"  
11             >  
12         </LinearLayout>  
13           
14         <View   
15             android:layout_width="1dp"  
16             android:layout_height="20dp"  
17             android:background="@color/pink_light"  
18             />  
19           
20         <LinearLayout   
21             android:layout_width="wrap_content"  
22             android:layout_height="20dp"  
23             android:background="@color/blue_light"  
24             android:layout_weight="2"  
25             >  
26         </LinearLayout>  
27     </LinearLayout>  

 

此处,主要是权重中间可以加间隔

posted on 2015-02-01 12:30  洛易  阅读(373)  评论(0编辑  收藏  举报