Hey guys,
Is there a way to specify layout label color dynamically via the resources or the code?
Thanks!
class MyText extends Ui.Drawable
{
static var backgroundColor = Gfx.COLOR_BLACK;
static var foregroundColor = Gfx.COLOR_WHITE;
var font;
var text;
var justification;
function initialize(params) {
Drawable.initialize(params);
font = params[:font];
text = params[:text];
justification = params[:justification];
}
function draw(dc) {
dc.setColor(foregroundColor, backgroundColor);
dc.drawText(locX, locY, font, text, justification);
}
}
// then to change the text color of all of your text elements
MyText.backgroundColor = Gfx.COLOR_WHITE;
MyText.foregroundColor = Gfx.COLOR_BLACK;
// force a redraw with the new colors
Ui.requestUpdate();