//项目源码附上,可以下载共享!<!--     单选按钮操作测试:1、单选按钮:RadioButton 需要配合 RadioGroup 进行使用,RadioGroup 是 RadioGroup 的承载体2、每一组RadioGroup 里面只能有一个RadioButton 被选中,不同的组之间互不影响;3、一个RadioGroup 里面至少包含两个RadioButton , 能包含多个单选按钮;4、每一组RadioGroup 中都有一个默认的被选中的单选按钮,大部分的情况下建议选择第一个为默认选择案例测试:选择喜欢的颜色--><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:gravity="center_horizontal"    android:orientation="vertical" >    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="单选按钮测试" />    <!-- 单选按钮的组  , 里面包含的是三个单选按钮 , 进行选择的测试 -->    <RadioGroup        android:id="@+id/group"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_marginLeft="20dp"        android:orientation="horizontal" >        <RadioButton            android:id="@+id/radioRed"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:checked="true"            android:text="红色" />        <RadioButton            android:id="@+id/radioGreen"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="绿色" />        <RadioButton            android:id="@+id/radioBlack"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="黑色" />    </RadioGroup>    <!-- 复选框的测试 -->    <!--    一组: CheckBox 能同时的选择多个,每次点击的时候可以选择是否被选中,在UI 中默认的是以矩形的方式显示;    事件:CompoundButton.OnCheckedChangeListener  后部分与按钮  状态控件的事件名称一致,加以不同的前缀进行区别    -->    <TextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:gravity="center"        android:text="请选择您的爱好"        android:textStyle="normal" />    <CheckBox        android:id="@+id/cb1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="游泳" />    <CheckBox        android:id="@+id/cb2"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="散步" />    <CheckBox        android:id="@+id/cb3"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="看书" />    <CheckBox        android:id="@+id/cb4"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="篮球" />    <!-- 状态开关测试 -->    <!--    控件名称:ToggeButton     属性:设置开/关的时候对应的文本的值:textOn/textOff     -->    <!-- 开关转换器   默认是开 纵向 -->    <ToggleButton        android:id="@+id/toggle"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:checked="true"        android:textOff="横向排列"        android:textOn="纵向排列" />    <!-- 使用线性布局结合状态栏的排列 -->    <LinearLayout        android:id="@+id/linears"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:orientation="vertical" >        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="clock1" />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="clock2" />        <Button            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="clock3" />    </LinearLayout></LinearLayout><!--     时钟测试AnalogClock  模拟时钟DigitalClock  数字时钟--><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="@drawable/a"    android:gravity="center_horizontal"    android:orientation="vertical" >    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="时钟测试" />    <AnalogClock        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_gravity="center" />    <!-- 数字时钟 -->    <!--    时钟(AnalogClock和DigitalClock)的功能和用法:AnalogClock继承了View组件,重写了View的OnDraw方法,它会在View上显示模拟时钟。DigitalClock本身就继承了TextView,也就是说它本身就是文本框,只是它里面显示的内容是当前时间。AnalogClock和DigitalClock都会显示当前时间,不同的是;DigitalClock显示数字时钟,可以显示当前的秒数; AnalogClock显示模拟时钟,不会显示当前秒数;    -->    <DigitalClock        android:layout_width="wrap_content"        android:layout_height="wrap_content" /></LinearLayout>

更多相关文章

  1. tcping测试服务器TCP端口
  2. android footer view
  3. Android(安卓)自动开关机
  4. [Android(安卓)Samples视频系列之ApiDemos] App-Activity-Intent
  5. Android(安卓)studio安装与调试
  6. Android(安卓)Button按钮点击变换字体颜色
  7. android 自动化测试 monkeyrunner
  8. 新浪微博布局学习——妙用TabHost
  9. Android开发底部点击按钮从屏幕底部滑出面板(一)

随机推荐

  1. Android(安卓)API之android.view.View.Me
  2. 关于android studio升级3.0以后自动输出a
  3. Android(安卓)4.4源码编译环境升级gcc版
  4. android广播的使用
  5. Android拨号键盘增加魔力爱心数字
  6. Android(安卓)时间戳的转换
  7. androidpn No response from server
  8. App优化之提升你的App启动速度之实例挑战
  9. android 使用getDrawable和BitmapFactory
  10. android studio导入项目报错Plugin with