0

I'm trying to add press effect to my button I have a button with android:drawableStart="@drawable/my_image" and I've added

android:background="?attr/selectableItemBackgroundBorderless" android:foreground="?attr/selectableItemBackgroundBorderless"

lines but didn't worked. Also I created a drawalbe for ripple effect with below code

<?xml version="1.0" encoding="utf-8"?>
<selector>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/solid_red">
    <item android:state_pressed="true">
        <item android:drawable="@android:color/white" />
    </item>
</ripple>
</selector>

android:background="@drawable/ripple_effect"
android:foreground="@drawable/ripple_effect"

but this is supports only if api under 21 and even if it's works it's now showing up because of image and also I want to add to foreground but when I added it It's covering whole image I just want to create a simple button press effect like ios default button press effect. Is there any way to do it without duplicate it and no using any library? Thanks.

tpbafk
  • 501
  • 5
  • 26
  • Don't try to make an iOS effect on Android. We have our own standard effects. Do things the Android way on Android, otherwise your app looks like a crappy port. – Gabe Sechan Jun 05 '18 at 19:39
  • Actually you'r right but default press effect is not giving an effective feedback to user, when I'm using normal button it's ok but with a button that covered with a full image it is not giving real feedback. Also I tried the answer but same problem low ripple effect not seems good. You have a better idea to do that ? Like FAB button ? – tpbafk Jun 05 '18 at 20:12

0 Answers0