Android Question Button Properties

Duque

Active Member
Licensed User
Longtime User
Friends I need help, I created a panel which I add a few buttons per code but I can not find the properties for:
* Put an image on the button
* Know if pressed or not
* Round the top corners only
 

Duque

Active Member
Licensed User
Longtime User
Thanks, it worked perfectly, it is possible to round off only the top corners, not all corners

example:

Corner radius (0,0,5,5)
 
Upvote 0

Duque

Active Member
Licensed User
Longtime User
'I have solved the click to the button and change the image with this function, as for rounding, you propose to create panels and use them as buttons?
code:
B4X:
Sub estiloB2(b As Button)
'al clic
    Dim img1 As BitmapDrawable
     img1.Initialize(LoadBitmap(File.DirAssets,"ant.ico"))
'al soltar
    Dim img2 As BitmapDrawable
     img2.Initialize(LoadBitmap(File.DirAssets,"carg.ico"))

    Dim cambio As StateListDrawable
    cambio.Initialize
'al click
    Dim states(2) As Int
    states(0) = cambio.state_enabled
    states(1) = -cambio.state_pressed
    cambio.addState2(states, img1)
'al soltar
    Dim states(1) As Int
    states(0) = cambio.state_pressed
    cambio.addState2(states, img2)
    b.Background = cambio
End Sub
 
Last edited:
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
CODETAGS.png
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
create panels and use them as buttons?


B4X:
Sub imgpanel_Touch (Action As Int, X As Float, Y As Float)
   Select Action
        Case Activity.ACTION_DOWN
                'this part is equivalent to _click event
        

        End Select  
           End If
 
Upvote 0
Top