android中的單選和多選框

來源:互聯網
上載者:User

標籤:

先展示一下

大致代碼如下:

 1 <?xml version="1.0" encoding="utf-8"?> 2 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 3     android:layout_width="fill_parent" 4     android:layout_height="fill_parent" > 5  6     <TableRow 7         android:id="@+id/tableRow1" 8         android:layout_width="wrap_content" 9         android:layout_height="wrap_content" >10 11         <TextView12             android:id="@+id/textView1"13             android:layout_width="wrap_content"14             android:layout_height="wrap_content"15             android:text="性別:"16             android:textSize="11pt" />17 18         <RadioGroup19             android:layout_gravity="center_horizontal"20             android:orientation="horizontal" >21 22             <RadioButton23                 android:id="@+id/radioButton1"24                 android:layout_width="wrap_content"25                 android:layout_height="wrap_content"26                 android:text="男" />27 28             <RadioButton29                 android:id="@+id/radioButton2"30                 android:layout_width="wrap_content"31                 android:layout_height="wrap_content"32                 android:text="女" />33         </RadioGroup>34     </TableRow>35 36     <TableRow37         android:id="@+id/tableRow2"38         android:layout_width="wrap_content"39         android:layout_height="wrap_content" >40 41         <TextView42             android:id="@+id/textView2"43             android:layout_width="wrap_content"44             android:layout_height="wrap_content"45             android:text="喜歡的顏色:" />46 47         <LinearLayout48             android:layout_width="wrap_content"49             android:layout_height="wrap_content"50             android:orientation="vertical" >51 52             <CheckBox53                 android:id="@+id/checkBox2"54                 android:layout_width="wrap_content"55                 android:layout_height="wrap_content"56                 android:text="紅色" />57 58             <CheckBox59                 android:id="@+id/checkBox3"60                 android:layout_width="wrap_content"61                 android:layout_height="wrap_content"62                 android:text="綠色" />63 64             <CheckBox65                 android:id="@+id/checkBox1"66                 android:layout_width="wrap_content"67                 android:layout_height="wrap_content"68                 android:text="藍色" />69         </LinearLayout>70     </TableRow>71 72 </TableLayout>

 

android中的單選和多選框

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.