android5.0程序开发之RadioButton控件

 时间:2024-10-15 15:59:11

1、启动eclipse程序,新建一android5.0工程文件RadioButtonDemo。

android5.0程序开发之RadioButton控件

2、在activity_main.xml文件中改变界面的布局为线性向下布局。不改变的话多个控件会叠加在一起。

android5.0程序开发之RadioButton控件

3、在activity_main.xml文件中加入一个TextView控件、一个Rad坡纠课柩ioGroup组件和两个RadioButton控件。

android5.0程序开发之RadioButton控件

4、再双击打开MainActivity.java文件,导入TextView控件类、RadioGroup和RadioButton控件类声明。

android5.0程序开发之RadioButton控件

5、在程序中加入文本控件和两个RadioButton控件的引用代码。

android5.0程序开发之RadioButton控件

6、分别增加RadioButton1和RadioButton2的执行代码。

android5.0程序开发之RadioButton控件

7、运行程序,分别点击RadioButton1和RadioButton2,可见如下效果:

android5.0程序开发之RadioButton控件android5.0程序开发之RadioButton控件
  • android5.0程序开发之RatingBar控件
  • android5.0程序开发之SeekBar控件
  • android5.0程序开发之图片按钮ImageButton
  • android5.0程序开发之TextView样式化
  • Android开发之RadioGroup和RadioButton导航效果
  • 热门搜索
    奢侈怎么读 小米盒子怎么看电视直播 字母哥为什么叫字母哥 大头菜的家常做法 汤唯为什么被封杀 含羞草为什么会合拢 绿萝为什么叶子发黄 孟晚舟为什么姓孟 竹字五笔怎么打 肚子咕噜咕噜响是怎么回事