Material Design Button波纹效果

来源:互联网 发布:驱动注入源码 编辑:程序博客网 时间:2024/05/18 17:43

波纹效果(Ripple):自带需要在android L也就是5.0之后生效。

这里写图片描述

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

详细:博客地址:http://blog.csdn.net/qq_16628781/article/details/51505263

还有一种是直接ripple修改添加shape:

<?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/colorPrimary"></solid>            <corners android:radius="6dp"></corners>        </shape>    </item></ripple>

一样也是有波纹的圆角