Android Question Remove button shadow

devmobile

Active Member
Licensed User
Buttons are elevated by default in the material theme. If you set their background to a non-default background then the elevation will be removed.
I set background for it with Statelistdrawable
But some button didn't removed shadow
 
Upvote 0

Fabio Campanella

Member
Licensed User
Longtime User
I have the same problem and I have already changed the background but in the certain displays show this:

The second image show in the s6 edge display and others phones and tablets ba4calendar.png Screenshot_20170810-131041.png
 
Upvote 0

Fabio Campanella

Member
Licensed User
Longtime User
No, I did not fix it.
The problem is that the version of android lollipop has introduced this thing, and to remove it we need to call button.setStateListAnimator (null) but this is not possible in B4a.

Is there a trick to do that?
 
Upvote 0

devmobile

Active Member
Licensed User
No, I did not fix it.
The problem is that the version of android lollipop has introduced this thing, and to remove it we need to call button.setStateListAnimator (null) but this is not possible in B4a.

Is there a trick to do that?
I use below sub
B4X:
Sub RemoveShadow(Button1 As Button)
    Dim sdk As Phone
    If sdk.SdkVersion < 21 Then Return
    Dim jo As JavaObject
    jo = Button1
    jo.RunMethod("setStateListAnimator", Array(Null))
End Sub
 
Upvote 0
Top