Android之实现点击波纹效果
使用Theme.AppCompat.Light系列主题
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
可以通过如下XML设置波纹的效果:
波纹有边界
android:background="?attr/selectableItemBackground"
波纹超出边界
android:background="?attr/selectableItemBackgroundBorderless"
可以通过设置xml属性来设置波纹颜色:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item><!--设置ActionBar颜色--> <item name="colorPrimaryDark">@color/colorPrimaryDark</item><!--设置状态栏颜色--> <item name="colorAccent">@color/colorAccent</item><!--设置checkbox等控件的选中颜色--> <item name="colorControlHighlight">@color/colorAccent</item><!--设置波纹颜色--> </style>