B4J Question Colors and ColorDrawable and B4X

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello,

I noticed that the colors and colordrawable objects don't exist in B4X and B4J. What's the equivalent property if I want to set the background color of a label in B4J or B4XPages project?
In B4A I had, for example:

B4X:
    Dim lblStatus As Label
    Dim color1 As ColorDrawable
    color1.Initialize2(Colors.Red,50,0,Colors.Black)
    lblStatus.Background = color1

What's the equivalent code in B4X?

Thanks!
 

William Lancee

Well-Known Member
Licensed User
Longtime User
B4XView is a powerful cross platform equalizer.

B4X:
    Dim lblStatus As Label
    lblStatus.Initialize("")
    Dim lblStatusX As B4XView = lblStatus
    lblStatusX.SetColorAndBorder(xui.Color_Red, 1dip, xui.Color_Black, 50dip)

'if not yet added to form, for example root in B4XPages
    Root.AddView(lblStatusX, 200dip, 200dip, 300dip, 150dip)
End Sub
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
B4XView is a powerful cross platform equalizer.

B4X:
    Dim lblStatus As Label
    lblStatus.Initialize("")
    Dim lblStatusX As B4XView = lblStatus
    lblStatusX.SetColorAndBorder(xui.Color_Red, 1dip, xui.Color_Black, 50dip)

'if not yet added to form, for example root in B4XPages
    Root.AddView(lblStatusX, 200dip, 200dip, 300dip, 150dip)
End Sub
Thanks !!!
 
Upvote 0
Top