Ripple water ripple effect, that is, ripple effect.
There are two types of ripple effects:
1, Ripple has boundary: ripple Ripple effect is only displayed inside the control
Android:background= "? Android:attr/selectableitembackground"
2, ripple out of bounds: ripple ripple effect is not restricted inside the control
Android:background= "? android:attr/selectableitembackgroundborderless"
By adding the code to the layout file, you can control the display area of the ripple effect more flexibly.
To set the color of the ripple:
Android:colorcontrolhighlight: Set Ripple Color
Set the selected color for a control such as a checkbox:
Android:coloraccent: Set the selected color of a control such as a checkbox
res/drawable/Ripple_round.xml
<?XML version= "1.0" encoding= "Utf-8"?><Ripplexmlns:android= "Http://schemas.android.com/apk/res/android"Android:color= "? Android:colorprimary"> <Item> <ShapeAndroid:shape= "Oval"> <SolidAndroid:color= "? Android:colorprimary" /> </Shape> </Item></Ripple>
res/drawable/Oval.xml
<?XML version= "1.0" encoding= "Utf-8"?><Ripplexmlns:android= "Http://schemas.android.com/apk/res/android"Android:color= "? Android:colorcontrolhighlight"> <Item> <ShapeAndroid:shape= "Oval"> <SolidAndroid:color= "#738ffe" /> </Shape> </Item></Ripple>
Used in Layout files:
< Button Android:id = "@+id/fab_button" android:layout_width= "56DP" android:transitionname= "Fab" Android:layout_height = "56DP" android:background= "@drawable/ripple_round" android:elevation = "5DP"/>
Android 5.0--Ripple effect