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

RB Smissaert

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

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Longtime 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
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime 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
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4A_9wN2T1IBcw.png
 
Upvote 0
Top