Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove shadow effect on android button

I have added a simple button to my layout , and I have deleted the text and set an image with transparency as its background. but unfortunately there is a drop shadow effect on my button and I can't remove it. I'll appreciate if you have any experience with it help me.
Thanks!

like image 981
m0j1 Avatar asked Jan 09 '15 18:01

m0j1


People also ask

How to remove the shadow of button in Android?

To remove the shadow of Floating Action Button in layout file, set the elevation attribute with zero value as shown in the following code snippet. Please note that the elevation attribute is referenced from xmlns:app=”http://schemas.android.com/apk/res-auto” namespace.

How do you remove an elevation button?

try to set android:elevation="0dp" to your main layout.


2 Answers

on Button tag set

android:stateListAnimator="@null"

example:

<Button
        android:id="@+id/button1"
        android:layout_height="50dp"
        android:layout_width="match_parent"
        android:stateListAnimator="@null"/>
like image 199
msamardzic Avatar answered Oct 20 '22 08:10

msamardzic


Your xml , instead of the button that you have, should be like this:

    <ImageButton android:src="@drawable/yourimagename"
     android:id="@+id/button1"
     android:layout_width = "wrap_content"
     android:layout_height = "wrap_content"
     android:background="@null"
     />

If you have any problems just let me know ;)

like image 29
Dyna Avatar answered Oct 20 '22 09:10

Dyna