Android Question Button ColorDrawable Alpha

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

In the designer I have set a button with a Alpha level but when I tap on that button during runtime I want to change it's alpha value.

How can I change the ColorDrawable Alpha value to something else when the user taps on the button ?

Anyone able to help ?
 

Lahksman

Active Member
Licensed User
Longtime User
You could use the button_Down and button_Up events.

B4X:
Sub button1_Down
    Dim cd As ColorDrawable
    cd.Initialize(Colors.ARGB(100,50,50,250),0dip)
    button2.Background = cd
End Sub
Sub button1_Up
    Dim cd As ColorDrawable
    cd.Initialize(Colors.ARGB(255,50,50,250),0dip)
    button2.Background = cd
End Sub
 
Upvote 0
Top