I made a button with the desired design as shown in the picture.
But when I click the button, the click effect does not appear.
The cause lies in the stateListAnimator="@null"
property.
Clearing this property has no elevation effect.
And also, if you don't apply the backgroundTint
to white
, the shaodw
is not visible.
This is a must have property because I want an elevation
effect on a button.
The second way I do it is to use OutLineButton
.
This also creates a similar design i want, but applying only 1dp of elevation
effect will apply
excessive elevation effect.
I don't know why either.
What should I do?
Why is this happening?
<Button
android:id="@+id/delete_set"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:drawableLeft="@drawable/ic_remove_routine"
android:text="DELETE SET"
android:textSize="12dp"
android:textColor="@color/orgin_text_color"
android:elevation="10dp"
android:stateListAnimator="@null"
android:layout_marginTop="10dp"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
/>
<Button
android:id="@+id/add_set"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_add_routine"
android:backgroundTint="@color/white"
android:text="ADD SET"
android:textSize="12dp"
android:textColor="@color/orgin_text_color"
android:elevation="10dp"
android:stateListAnimator="@null"
android:layout_marginTop="10dp"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
/>