選項按鈕和複選框,選項按鈕複選框

來源:互聯網
上載者:User

選項按鈕和複選框,選項按鈕複選框

 

Demo2\radiocheck_demo\src\main\res\layout\activity_main.xml

 1 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 2     xmlns:tools="http://schemas.android.com/tools" 3     android:layout_width="match_parent" 4     android:layout_height="match_parent" 5     tools:context=".MainActivity" 6     android:orientation="vertical"> 7  8     <TableRow> 9         <TextView10             android:layout_width="wrap_content"11             android:layout_height="wrap_content"12             android:text="性別:"13             android:textSize="20sp"/>14         <!--定義一組選項按鈕-->15         <RadioGroup16             android:orientation="horizontal"17             android:layout_gravity="center_horizontal">18             <!--定義兩個選項按鈕-->19             <RadioButton20                 android:layout_width="wrap_content"21                 android:layout_height="wrap_content"22                 android:text="男"/>23             <RadioButton24                 android:layout_width="wrap_content"25                 android:layout_height="wrap_content"26                 android:text="女"27                 android:checked="true"/>28         </RadioGroup>29     </TableRow>30 31     <TableRow>32         <TextView33             android:layout_width="wrap_content"34             android:layout_height="wrap_content"35             android:text="喜歡的顏色"36             android:textSize="20sp"/>37         <!--定義一個垂直的線性布局-->38         <LinearLayout39             android:layout_gravity="center_horizontal"40             android:orientation="vertical"41             android:layout_width="wrap_content"42             android:layout_height="wrap_content">43             <!--定義三個複選框-->44             <CheckBox45                 android:layout_width="wrap_content"46                 android:layout_height="wrap_content"47                 android:text="紅色"48                 android:checked="true"/>49             <CheckBox50                 android:layout_width="wrap_content"51                 android:layout_height="wrap_content"52                 android:text="藍色" />53             <CheckBox54                 android:layout_width="wrap_content"55                 android:layout_height="wrap_content"56                 android:text="綠色" />57         </LinearLayout>58     </TableRow>59 60 </TableLayout>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.