I like to know how to change the background color of a B4xview by ARGB or RGB or Hex values, in my case RGB or hex values for a Label, please the easier way. Thank you!
Next Questions in this context:
I like to have 14 different R, G and B values for 14 different states of my label. I learned the fastest way to use tables in b4x is to use maps. But each key is unique. But I like to have Keys like 1.R 1.G 1B, 2.R and so on. And i like to use the number of the key as a criterium for the state. Is there a short way to do so? Or another better solution? Thanks in advance!
Dim State1 as MyState
State1.R = 50
State1.G = 50
State1.B = 50
Label1.Color = Color.RGB(State1.R, State1.G, State1.B)
For convenience you should create a Sub where you declare all the States so then they will be ready to use.
But you must declare even all States in Globals.
Instead of State1 you can use S1 to make it shorter if you like it.
How is the state defined ?
Do you really need 14 different R G B values, couldn't you define directly 14 colors ?
I would define the states as an Int with values from 0 to 13 and an array of colors.
B4X:
Private State As Int
Private StateColor(14) As Int
It should be if I've got it anytime to an good end a version of '2048' game.
I've decided to write all 14 different RGB values in a row to an array.
I get the values like this:
Power from base 2, exeptional power=0
exp=Logarithm(label(any no).text,2)
label(any no).Color = Colors. RGB(RGBval(exp*3),RGBval(exp*3+1),RGBval(exp*3+2))
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.