RadioButton、CheckBox去除选中时的动画阴影效果
2017-07-04 15:23
3927 查看
CheckBox默认选中和取消选中都有个灰色阴影效果,去除方法如下:
方法一:(评论区建议)
直接使用background属性。颜色或图片android:background="@drawable/ic_launcher"
android:background="@android:color/transparent"
方法二:(AS3.0上不能使用)
1.在CheckBox的布局中添加button属性android:button="@null"2.在res/drawable文件夹下新建一个selector文件check_selector.xml<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_launcher" android:state_checked="true"></item>
<item android:drawable="@drawable/ic_launcher_round" android:state_checked="false"></item>
</selector>解析:该xml文件中有两个item,第一个是控件选中状态为true时展示的图片为ic_launcher,第二个是选中状态为false的情况。selsector不但有是否选中,还有许多状态,如:state_focused 是否聚焦
3.在CheckBox的布局中添加background属性android:background="@drawable/check_selector"
方法一:(评论区建议)
直接使用background属性。颜色或图片android:background="@drawable/ic_launcher"
android:background="@android:color/transparent"
方法二:(AS3.0上不能使用)
1.在CheckBox的布局中添加button属性android:button="@null"2.在res/drawable文件夹下新建一个selector文件check_selector.xml<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_launcher" android:state_checked="true"></item>
<item android:drawable="@drawable/ic_launcher_round" android:state_checked="false"></item>
</selector>解析:该xml文件中有两个item,第一个是控件选中状态为true时展示的图片为ic_launcher,第二个是选中状态为false的情况。selsector不但有是否选中,还有许多状态,如:state_focused 是否聚焦
3.在CheckBox的布局中添加background属性android:background="@drawable/check_selector"
<CheckBox android:id="@+id/check_child" android:layout_width="20dp" android:layout_height="20dp" android:checked="false" android:gravity="center" android:button="@null" android:background="@drawable/check_selector" android:layout_centerVertical="true" />运行后,阴影效果将不会再显示
相关文章推荐
- Android TV常用动画的效果,View选中变大且有阴影(手机也能用)
- CheckBox或RadioButton自定义选中/非选中效果的注意点
- 我的Android进阶之旅------>Android如何去除GridView的按下或点击选中后的背景效果
- Android ListView 去除边缘阴影、选中色、拖动背景色等
- ios 去除按钮的按下效果(阴影)
- [置顶] Android 偷梁换柱!!!带你实现修改shareSDK九宫格布局,去除阴影的动画。
- trick:CSS 3+checkbox实现JQuery的6个基本动画效果
- AnimCheckBox按钮点击动画效果《IT蓝豹》
- bootstrap 设置checkbox部分选中效果
- Win7系统如何去除PNG图标的边缘阴影效果
- Android ListView 去除边缘阴影、选中色、拖动背景色、行高、addFootView等
- RecyclerView,ListView去除边缘动画效果
- Android布局之 ListView 去除边缘阴影、选中色、拖动背景色等(android:cacheColorHint="#00000000")
- Android ListView 去除边缘阴影、选中色、拖动背景色等
- 滑动结束 Activity(二)阴影效果和动画的实现
- 滑动结束 Activity(二)阴影效果和动画的实现
- AnimCheckBox按钮点击动画效果《IT蓝豹》
- JS实现表单中checkbox对勾选中增加边框显示效果
- 去除ActionBar的阴影效果以及设置ActionBar的高度
- ios 去除按钮的按下效果(阴影)