Hello everyone~
I have a question.
Can I use one createLabel to set two or more different style , color or fontSize?
is it possible to reach?
var lb = Ti.UI.createLabel({ text : "here have much text, but I want to set different color and size on 'different' text.", width : 102, height : 30, top : 100, left : 10, font : { fontSize : '20', }, color: "#ccc" }); win.add(lb);Suppose I have to set more different color or size in a long text.
is it have to set different createLabel to reach all the same?
thank you very much.
4 Answers
Accepted Answer
You would either have to do like you said, or use StyledLabel from the Marketplace.
//under event lb.color='white'; // to change label color lb.font = { fontSize : '17', }; // to change font size
You can also use a WebView to present a long block of formatted text. It really depends on your situation.
No, the same style applies for whole text
you have long text and wanna apply different style then you can do string manipulations with label text and can make nested labels and can give your required string length to your custom labels
Your Answer
Think you can help? Login to answer this question!