Reputation: 2216
I want to fully customize button in android, with keeping all its juicy material design styles.
The code i used for this is
<resources>
<style name="AppTheme.NoActionBar">
<item name="android:colorButtonNormal">#8126f3</item>
</style>
</resources>
Then i wanted to put my own drawable into the button and keep the Material Design effects . so i created a drawable (V21) and assigned it as background to the button.
button_ripple.xml
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item android:drawable="@drawable/take_ride_map_btn"/>
</ripple>
But now the problem is that it does not have a elevation. And the ripple effect does not start at the point of touch.
I have looked into this, this, and this SO Question but these are not helpful with using the custom drawable into button.
Please do suggest how can i achieve this -
Elevation while having the custom drawable.
Start the Ripple Effect at the point where user touches.
Upvotes: 0
Views: 188
Reputation: 14835
you can always have the elevation if you set the button to wrap_content both ways i.e height and width and for the ripple effect you should use RippleDecoratorView.
You don't need to cast it to anything just wrap the button inside it in xml
and your good to go, plus its highly customizeable too
Upvotes: 0