android Material主题中的button效果
16lz
2021-01-25
在android5.0新增了ripple的效果,他可以运用到Button,ImageButton,TextView,以及一些布局容器。
首先,我们看android:Theme.Material.Light主题中设置的各种ripple效果属性的默认值:
1.- @drawable/item_background_material
2.- @drawable/item_background_borderless_material
3.- @style/Widget.Material.Light.Button.Borderless
4.- @style/Widget.Material.Light.Button.ButtonBar.AlertDialog
selectableItemBackground在drawable文件中文件内容为:有边界的效果
-
selectableItemBackgroundBorderless在drawable文件中文件内容为:无边界的效果(需要api21以上)
borderlessButtonStyle最后引用的style就是如下:
他实际上就是设置了background的属性:
buttonBarButtonStyle实际上也是调用了borderlessButtonStyle的style,就是也是调用了相同的background:
前两种在xml中设置background即可,如:
android:background="?android:selectableItemBackground"
前两种在xml中设置style即可,如:
style="?android:buttonBarButtonStyle"
更多相关文章
- 一款常用的 Squid 日志分析工具
- GitHub 标星 8K+!一款开源替代 ls 的工具你值得拥有!
- RHEL 6 下 DHCP+TFTP+FTP+PXE+Kickstart 实现无人值守安装
- Linux 环境下实战 Rsync 备份工具及配置 rsync+inotify 实时同步
- Android-AIDL通信
- android:paddingBottom=“@dimen/activity_horizontal_margin"的
- Android解析网页响应xml格式文件的一种方法
- Android(安卓)系列的光照效果
- Android(安卓)Activity界面切换添加动画特效 (修改)