自定义单选按钮(RadioButton)的样式
来源:互联网 发布:淘宝怎样推广最有效 编辑:程序博客网 时间:2024/05/16 05:41
效果图
实现步骤
1 新建一个xml文件–radio.xml,这是单选按钮的适配器
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false" android:drawable="@drawable/icon_button0" /> <item android:state_checked="true" android:drawable="@drawable/icon_button1" /> </selector>
2 在/layout下新建一个布局xml文件,代码如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" ><!--FrameLayout使得按钮浮动于地图控件之上--> <FrameLayout android:id="@+id/fram1" android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <!-- 百度地图控件 --> <com.baidu.mapapi.map.MapView android:id="@+id/bmapView" android:layout_width="fill_parent" android:layout_height="341dp" android:clickable="true" > </com.baidu.mapapi.map.MapView> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:orientation="vertical" > <RadioGroup android:id="@+id/MapType" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:orientation="horizontal" > <RadioButton android:id="@+id/normal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:checked="true" <!--注意下面两行代码--> android:button="@null" android:background="@drawable/radio" android:text="普通" /> <RadioButton android:id="@+id/statellite" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:button="@null" android:background="@drawable/radio" android:text="卫星" /> </RadioGroup> </LinearLayout> </FrameLayout></LinearLayout>
well done!!
0 0
- 自定义单选按钮(RadioButton)的样式
- 自定义RadioButton ,单选按钮
- android 自定义RadioButton(单选按钮)图标随便定.
- RadioButton(单选按钮)
- RadioButton单选按钮
- RadioButton单选按钮
- RadioButton单选按钮
- RadioButton单选按钮
- 单选按钮RadioButton
- 单选按钮RadioButton
- RadioButton单选按钮
- 单选按钮RadioButton
- 自定义RadioButton和Checkbox的按钮样式遇到的坑
- radioButton的使用(单选按钮的使用)
- RadioButton和CheckBox自定义按钮图片的样式
- Android 单选按钮RadioButton的使用
- 单选按钮 RadioButton 的使用
- Android 单选按钮RadioButton的使用
- 浏览器输入URL访问服务器过程
- 图算法小结(prime与dijkstra对比) CodeBlocks再次安装
- 省赛选拔赛——个人赛第三场
- QQ实现第三方登录
- Ubuntu14.04密码正确 进不去桌面系统(已测试恢复正常)
- 自定义单选按钮(RadioButton)的样式
- 分布式和服务器并发
- 字符编码笔记:ASCII,Unicode和UTF-8
- 欢迎使用CSDN-markdown编辑器
- 第六周——程序阅读(五)
- 快速排序
- Android的世界
- MD5算法实例
- 深度学习介绍(五)pooling