Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing the shadow on an android button

Tags:

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

like image 959
Scottyers Avatar asked Feb 26 '15 14:02

Scottyers


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.

What are Android shadows?

Shadows are drawn by the parent of the elevated view, and thus subject to standard view clipping, clipped by the parent by default. Elevation is also useful to create animations where widgets temporarily rise above the view plane when performing some action.


1 Answers

How about

        <Button            ..<code>              android:stateListAnimator="@null"             ..<code>        </Button> 
like image 111
Vrashabh Irde Avatar answered Oct 03 '22 20:10

Vrashabh Irde