仿微信 RadioButton 自定义点击效果
来源:互联网 发布:vb sub function区别 编辑:程序博客网 时间:2024/05/21 18:43
1.Android Studio
步骤:
1.选中drawable目录后点击鼠标右键New-Drawable resource file,如图:
2.输入文件名称,点击ok,如图:
3.新建好之后即为selector,如图:
4.自定义xml
<item android:drawable="@drawable/tab_address_normal" android:state_checked="true"/> <!-- 选中时效果 --> <item android:drawable="@drawable/tab_address_pressed" android:state_checked="false"/> <!-- 未选中时效果 -->
5.在布局中使用自定义属性
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:orientation="vertical" android:id="@+id/fragment" android:layout_width="match_parent" android:layout_height="wrap_content"> </LinearLayout> <LinearLayout android:background="@drawable/bottom_bar" android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content"> <RadioGroup android:id="@+id/radiogroup" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="horizontal"> <RadioButton android:textColor="#eee" android:id="@+id/first" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/radio_image_talk" android:gravity="center_horizontal" android:text="聊天" /> <RadioButton android:textColor="#eee" android:id="@+id/two" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/radio_image_address" android:gravity="center_horizontal" android:text="联系人" /> <RadioButton android:textColor="#eee" android:id="@+id/three" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/radio_image_find" android:gravity="center_horizontal" android:text="朋友圈" /> <RadioButton android:textColor="#eee" android:id="@+id/four" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:button="@null" android:drawableTop="@drawable/radio_image_setting" android:gravity="center_horizontal" android:text="设置" /> </RadioGroup> </LinearLayout></RelativeLayout>
5.效果图
0 0
- 仿微信 RadioButton 自定义点击效果
- 取消RadioButton点击效果
- RadioButton自定义多选一效果
- Android Radiobutton 文字点击效果
- RadioButton点击带下划线效果
- RadioButton点击带下划线效果
- Fragment+RadioButton实现点击切换页面效果
- Fragment+RadioButton实现点击切换页面效果
- android RadioButton 点击时候出现点击声音的效果
- RadioButton按钮在后,自定义样式效果
- 自定义Button点击效果
- Button自定义点击效果
- 自定义图片点击效果
- Android开发RadioButton(app主界面点击效果)
- android自定义TabHost点击效果
- Android自定义Button点击效果
- android自定义button点击效果
- android自定义TextView点击效果
- p2p网络架构
- 华为笔试
- (iOS开发) 导航栏一侧有多个按钮的处理
- 在SpringMVC中获取request和response
- centos 6 编译node.js不通过 错误:make[1]: *** [/root/apps/node-v4.2.2/out/Release/obj.target/v8_base/deps/v8
- 仿微信 RadioButton 自定义点击效果
- 7.11 Git 工具 - 子模块
- 【前端开发】合并多个前端静态资源文件,减少HTTP请求次数
- 让鼠标漫天飞舞:在内核中实现鼠标的中断处理
- 海康威视 windows64系统 C++网络摄像头测试Demo
- begin tran ~~rollback
- Java利用Zxing生成二维码
- MPAndroidChart饼状图
- 从留言板开始做网站(九)——简单的验证码和CSS选择器优先级