实现动画的view
<com.rey.material.widget.Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="登陆"
>android:background="@drawable/button_selector"
android:textColor="@color/logincolorfont"/>
资源文件夹
注:两文件同名
drawable资源下
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/touming" android:state_pressed="false"/> //未按压颜色
<item android:drawable="@color/logincolorend" android:state_pressed="true"/> //按压时颜色
</selector>
drawable v21资源下
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/logincolorend"> //波纹颜色
<item android:drawable="@color/white"/> //底色,透明失效
</ripple>