Android Question Can I set alpha level of button text in the designer?

RB Smissaert

Well-Known Member
Licensed User
Can't find this.
Looked for a RGBA to hex converter (in code) but couldn't fine one.

RBS
This code seems to work in VBA:

B4X:
Function RGBA2Hex(R As Byte, G As Byte, B As Byte, A As Byte) As String

    Dim lRGB As Long
    Dim lColor As Long

    lRGB = RGB(R, G, B)

    lColor = (lRGB And &HFF00&) Or (lRGB And &HFF0000) \ &H10000 Or (lRGB And &HFF) * &H10000
    
    If A < 128 Then
        If A < 0& Then A = 0&
        lColor = lColor Or A * &H1000000
    Else
        If A > 255& Then A = 255&
        lColor = lColor Or (A - 128&) * &H1000000 Or &H80000000
    End If
    
    RGBA2Hex = Hex(lColor)

End Function
[CODE]

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Yes, you can set the button colors with the designer. Change the Drawable to StatelistDrawable.

If you have any other question then please start a new thread.
Yes, I just found out about the StatelistDrawable setting and that does indeed show the alpha setting for the button colour, but as
far as I can see not the button TextColour. Will check again later.

RBS
 
Top