Android Question Button elevation

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi to all! I've a button created programmatically. How can i set elevation to 0, and disable the shadow when i click on it? I tried this code, but on some devices happens what explained in this topic: https://www.b4x.com/android/forum/threads/app-crash-without-filter-logs.88681/

B4X:
Sub setElevation (b As View ,f As Float)
    Dim sdk As Phone
    Dim jo As JavaObject = b
    If sdk.SdkVersion > 20 Then
        jo.RunMethod("setElevation",Array As Object(f))
        jo.RunMethod("setStateListAnimator", Array(Null))
    End If
End Sub
 
D

Deleted member 103

Guest
Hi to all! I've a button created programmatically. How can i set elevation to 0, and disable the shadow when i click on it? I tried this code, but on some devices happens what explained in this topic: https://www.b4x.com/android/forum/threads/app-crash-without-filter-logs.88681/

B4X:
Sub setElevation (b As View ,f As Float)
    Dim sdk As Phone
    Dim jo As JavaObject = b
    If sdk.SdkVersion > 20 Then
        jo.RunMethod("setElevation",Array As Object(f))
        jo.RunMethod("setStateListAnimator", Array(Null))
    End If
End Sub
why do not you use a label or panel instead of a button?
 
Upvote 0
Top