I am using a ripple effect on my navigation drawer. I have set it like this and applied it to my ListView:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true" android:drawable="@color/black_200" /> <item android:state_pressed="true" android:color="@color/black_200"> <ripple android:color="@color/black_400" /> </item> <item android:drawable="@color/white" /> </selector>
I want the ripple background to remain the same like the normal activated state. Even when I define the color to be the same as the activated state, it gets darker and the ripple bubble gets even more dark. How can I color the background to be the same like the activated state and the ripple bubble to be the color I told it to be?
android:colorControlHighlight will give the ripple the same color as the built-in ripples in your app. If you don't like the default grey, you can specify what color you want android:colorControlHighlight to be in your theme.
The touch feedback in Android is a must whenever the user clicks on the item or button ripple effect when clicking on the same, gives confidence to the user that the button has been clicked so that they can wait for the next interaction of the app.
android.graphics.drawable.RippleDrawable. Drawable that shows a ripple effect in response to state changes. The anchoring position of the ripple for a given state may be specified by calling setHotspot(float, float) with the corresponding state attribute identifier.
It's a lot easier to do with styles:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> ... <item name="colorControlHighlight">@color/ripple_material_dark</item> ... </style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With