• android中的单选和多选框


    先展示一下效果图

    大致代码如下:

     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         <TextView
    12             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         <RadioGroup
    19             android:layout_gravity="center_horizontal"
    20             android:orientation="horizontal" >
    21 
    22             <RadioButton
    23                 android:id="@+id/radioButton1"
    24                 android:layout_width="wrap_content"
    25                 android:layout_height="wrap_content"
    26                 android:text="男" />
    27 
    28             <RadioButton
    29                 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     <TableRow
    37         android:id="@+id/tableRow2"
    38         android:layout_width="wrap_content"
    39         android:layout_height="wrap_content" >
    40 
    41         <TextView
    42             android:id="@+id/textView2"
    43             android:layout_width="wrap_content"
    44             android:layout_height="wrap_content"
    45             android:text="喜欢的颜色:" />
    46 
    47         <LinearLayout
    48             android:layout_width="wrap_content"
    49             android:layout_height="wrap_content"
    50             android:orientation="vertical" >
    51 
    52             <CheckBox
    53                 android:id="@+id/checkBox2"
    54                 android:layout_width="wrap_content"
    55                 android:layout_height="wrap_content"
    56                 android:text="红色" />
    57 
    58             <CheckBox
    59                 android:id="@+id/checkBox3"
    60                 android:layout_width="wrap_content"
    61                 android:layout_height="wrap_content"
    62                 android:text="绿色" />
    63 
    64             <CheckBox
    65                 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>
  • 相关阅读:
    RabbitMQ in Action(5): Clustering and dealing with failure
    RabbitMQ in Action (2): Running and administering Rabbit
    [转]Setting Keystone v3 domains
    Openstack中RabbitMQ RPC代码分析
    RabbitMQ in Action (1): Understanding messaging
    [转]Understanding OpenStack Authentication: Keystone PKI
    neutron的基本原理
    nova vnc proxy基本原理
    sersync+rsync做实时同步
    使用rsync备份数据
  • 原文地址:https://www.cnblogs.com/rollenholt/p/2505994.html
Copyright © 2020-2023  润新知