Removing the shadow on an android button

Scottyers picture Scottyers · Feb 26, 2015 · Viewed 14.5k times · Source

I have searched and tryed all found solutions to this. I need to remove the shadow from a button in android. Most of the solutions i found involve using an imagebutton and setting it's background. I tryed that and it works but my button has text so imagebutton is not an option. Unless there is a way to write to an imagebutton?

My second solution was:

android:fadingEdgeLength="0dp"

But nothing seemed to change. Third:

android:shadowColor="@color/application_transparent" />

Nothing changed here either.

I also tryed creating a custom shape with stroke 0 and setting the buttons background to it but still nothing. I prefer to do this in my Xml rather than programmatically but if that is the only way, so be it. Thanks in advance

Answer

Vrashabh Irde picture Vrashabh Irde · Feb 26, 2015

How about

        <Button
           ..<code>

            android:stateListAnimator="@null"

           ..<code>
       </Button>