Single choice button and check box, single choice button check box

Source: Internet
Author: User

Single choice button and check box, single choice button check box

 

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 = "Gender:" 13 android: TextSize = "20sp"/> 14 <! -- Define a group of radio buttons --> 15 <RadioGroup16 android: orientation = "horizontal" 17 android: layout_gravity = "center_horizontal"> 18 <! -- Define two radio buttons --> 19 <RadioButton20 android: layout_width = "wrap_content" 21 android: layout_height = "wrap_content" 22 android: text = "male"/> 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 = "Favorite color" 36 android: textSize = "20sp"/> 37 <! -- Define a vertical linear layout --> 38 <LinearLayout39 android: layout_gravity = "center_horizontal" 40 android: orientation = "vertical" 41 android: layout_width = "wrap_content" 42 android: layout_height = "wrap_content"> 43 <! -- Define three check boxes --> 44 <CheckBox45 android: layout_width = "wrap_content" 46 android: layout_height = "wrap_content" 47 android: text = "red" 48 android: checked = "true"/> 49 <CheckBox50 android: layout_width = "wrap_content" 51 android: layout_height = "wrap_content" 52 android: text = "blue"/> 53 <CheckBox54 android: layout_width = "wrap_content" 55 android: layout_height = "wrap_content" 56 android: text = "green"/> 57 </LinearLayout> 58 </TableRow> 59 60 </TableLayout>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.