1月17日 checkbox

7.checkbox 

xml

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent">
 5     
 6     <TextView
 7         android:id="@+id/tv_title"
 8         android:text="你会那些开发"
 9         android:textSize="20sp"
10         android:textColor="#000"
11         android:layout_width="wrap_content"
12         android:layout_height="wrap_content"
13         android:layout_marginBottom="10dp"
14         />
15 
16     <CheckBox
17         android:id="@+id/cb_1"
18         android:layout_width="wrap_content"
19         android:layout_height="wrap_content"
20         android:text="android"
21         android:textSize="20sp"
22         android:layout_below="@+id/tv_title"
23         />
24 
25     <CheckBox
26         android:id="@+id/cb_2"
27         android:layout_width="wrap_content"
28         android:layout_height="wrap_content"
29         android:text="ios"
30         android:textSize="20sp"
31         android:layout_below="@+id/cb_1"
32         />
33 
34     <CheckBox
35         android:id="@+id/cb_3"
36         android:layout_width="wrap_content"
37         android:layout_height="wrap_content"
38         android:text="H5"
39         android:textSize="20sp"
40         android:layout_below="@+id/cb_2"
41         />
42 
43     <CheckBox
44         android:id="@+id/cb_4"
45         android:layout_width="wrap_content"
46         android:layout_height="wrap_content"
47         android:text="其他"
48         android:textSize="20sp"
49         android:layout_below="@+id/cb_3"
50         />
51     <LinearLayout
52         android:layout_width="match_parent"
53         android:layout_height="wrap_content"
54         android:orientation="vertical"
55         android:layout_below="@+id/cb_4"
56         android:layout_marginTop="20dp"
57         >
58         <TextView
59             android:layout_width="wrap_content"
60             android:layout_height="wrap_content"
61             android:text="你的兴趣"
62             android:textSize="20sp"
63             android:textColor="#000"
64             />
65 
66         <CheckBox
67             android:id="@+id/cb_5"
68             android:layout_width="wrap_content"
69             android:layout_height="wrap_content"
70             android:text="编程"
71             android:textSize="20sp"
72             android:layout_marginTop="10dp"/>
73 
74         <CheckBox
75             android:id="@+id/cb_6"
76             android:layout_width="wrap_content"
77             android:layout_height="wrap_content"
78             android:text="做饭"
79             android:textSize="20sp"
80             android:layout_marginTop="10dp"/>
81 
82 
83 
84     </LinearLayout>
85 
86 </RelativeLayout>
原文地址:https://www.cnblogs.com/dty602511/p/14859586.html