您的位置:首页 > 移动开发 > Android开发

Android——为某个控件或者LinearLayout等添加水波纹效果

2017-11-01 20:18 330 查看
很多时候直接background添加那三种:

1.android:background=“?android:attr/selectableItemBackground”波纹有边界

2.android:background=“?android:attr/selectableItemBackgroundBorderless”波纹超出边界,就是一个圆型

还有一种就是button默认的。

可能一时无法改变背景,一种方法是外面套一个LinearLayout等设置背景色,还有个方法就是在drawer里面建 ripple。

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/colorPrimary">
<item >
<shape>
<solid android:color="@color/white"></solid>
</shape>
</item>
</ripple>


同样可以,要注意的是,控件有的默认不可点击,需要设置onclick为true才会有效果。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐