Reputation: 3970
There are a few places in my app that I place buttons on dark (not white) backgrounds. In this scenario the ripple effect is too dark to see. Is there a way to make the ripple a white color instead of gray?
Upvotes: 2
Views: 2492
Reputation: 56
Yes, there is the way.
Create xml (button.xml for example):
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/white">
<item android:drawable="@drawable/button_ripple" />
</ripple>
Create button_ripple.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="200dp"
android:height="50dp"/>
<solid
android:color="@color/accent" />
</shape>
Change android:color="@android:color/white" in button.xml to needed color for ripple effect and assign button.xml as a background to your button.
@color/accent is the normal state button color.
Upvotes: 3