So, I am trying to create a ripple effect with cusotm color and good success, in addition to the ripple effect, it removes the original background and thus creates the effect of a translucent ripple effect, which is not what I want.
Markup:
<Button android:layout_width="80dp" android:layout_height="80dp" android:text="Clicky" android:colorControlHighlight="@android:color/holo_blue_light" android:background="@drawable/selector"> </Button>
hood / selector.xml:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/ripple"/> <item android:drawable="@color/normal"/> </selector>
extractor hood / ripple.xml:
<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#7f7"> </ripple>
color.xml
<resources> <color name="normal">#070</color> </resources>
What do I need to do to keep the green (# 070) background while the ripple effect is applied? I believe this is an intention, right?
Edit
Now I have introduced shape , as suggested by AcademicDuck:
range hood / red_shape.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/normal" /> </shape>
This form refers to the now changed ripple:
extractor hood / ripple.xml:
<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:drawaleb="@drawable/red_shape"> </ripple>
Now the change is that when I click on the background, it's solid red instead of transparent. However, it does not pulsate.
android material-design
Nilzor
source share