ANDROID_MARS学习笔记_S01_008Linear_layout例子

1.netstone_layout.xml

 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="vertical"
 6     android:background="#440000" >
 7     <TextView
 8         android:layout_width="match_parent"
 9         android:layout_height="wrap_content" 
10         android:text="剪刀石头布"
11         android:gravity="center"/>
12     <LinearLayout 
13         android:orientation="horizontal"
14         android:layout_width="match_parent"
15         android:layout_height="wrap_content"
16         android:background="#ff0000"
17         android:gravity="center">
18         
19         <LinearLayout 
20             android:layout_width="0dp"
21             android:layout_height="wrap_content"
22             android:orientation="vertical"
23             android:background="#00ff00"
24             android:layout_weight="1"
25             android:gravity="center">
26             <ImageView 
27                 android:layout_width="wrap_content"
28                 android:layout_height="wrap_content"
29                 android:src="@drawable/wo"/>
30             <RadioGroup 
31                 android:layout_width="wrap_content"
32                 android:layout_height="wrap_content">
33                 <RadioButton 
34                     android:layout_width="wrap_content"
35                     android:layout_height="wrap_content"
36                     android:text="剪刀"/>
37                 <RadioButton 
38                     android:layout_width="wrap_content"
39                     android:layout_height="wrap_content"
40                     android:text="石头"/>
41                 <RadioButton 
42                     android:layout_width="wrap_content"
43                     android:layout_height="wrap_content"
44                     android:text="布"/>
45             </RadioGroup>
46         </LinearLayout>
47         
48         <LinearLayout 
49             android:layout_width="0dp"
50             android:layout_height="wrap_content"
51             android:orientation="vertical"
52             android:background="#00ff00"
53             android:gravity="center"
54             android:layout_weight="1">
55             <ImageView 
56                 android:layout_width="wrap_content"
57                 android:layout_height="wrap_content"
58                 android:src="@drawable/wo"/>
59             <RadioGroup 
60                 android:layout_width="wrap_content"
61                 android:layout_height="wrap_content">
62                 <RadioButton 
63                     android:layout_width="wrap_content"
64                     android:layout_height="wrap_content"
65                     android:text="剪刀"/>
66                 <RadioButton 
67                     android:layout_width="wrap_content"
68                     android:layout_height="wrap_content"
69                     android:text="石头"/>
70                 <RadioButton 
71                     android:layout_width="wrap_content"
72                     android:layout_height="wrap_content"
73                     android:text="布"/>
74             </RadioGroup>
75         </LinearLayout>
76     </LinearLayout>
77     
78     <Button 
79         android:layout_width="match_parent"
80         android:layout_height="wrap_content"
81         android:text="确定"
82         android:gravity="center"/>
83     <LinearLayout 
84         android:layout_width="match_parent"
85         android:layout_height="wrap_content"
86         android:orientation="horizontal"
87         android:gravity="center">
88         <TextView
89         android:layout_width="0dp"
90         android:layout_height="wrap_content" 
91         android:text="结果"
92         android:layout_weight="1"/>
93         <TextView
94         android:layout_width="0dp"
95         android:layout_height="wrap_content" 
96         android:text="测试结果"
97         android:layout_weight="1"/>
98     </LinearLayout>
99 </LinearLayout>
原文地址:https://www.cnblogs.com/shamgod/p/5185242.html