Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
monkeysource
Visitor

Newline in Label Node

Hi,

Really sorry for the basic question, but I've searched and can't find the answer. Does anyone know how to add new lines to the Label component. E.g.


     <Label 
              id = "bodyLabel" 
              width = "1000"
              height = "1000"
              text = "test  \n new line" 
              wrap = "true"
              horizAlign = "left" />        


 
I know in code it would be Chr(10) but don't know how to add this direct to strings in XML.

Thanks,

Ryan
0 Kudos
3 REPLIES 3
monkeysource
Visitor

Re: Newline in Label Node

I've found the solution, kinda obvious when you know how. For other users it's

&#10;

E.g


<Label 
              id = "bodyLabel" 
              width = "1000"
              height = "1000"
              text = "test  &#10; new line" 
              wrap = "true"
              horizAlign = "left" />    
0 Kudos
EnTerr
Roku Guru

Re: Newline in Label Node

Thanks for sharing!
I would have thought it's as simple as literally embedding the new line:
     <Label text = "test  
new line" 
              wrap = "true"
              horizAlign = "left" />

But no - not with XML. It's true that you can include new lines in attribute values. But what's also true apparently is that there is mandate to normalize[/url:j69i4sxg] these, in which new lines and tabs would get converted to spaces...









0 Kudos
chaklasiyanikun
Roku Guru

Re: Newline in Label Node

The same way. In label, both ways I tried to like below. 

  1. &#10;
  2. Chr(10)

But, Doesn't work for me. Is there any other option for this. I used the current version (9.3.0) and Cooper devices.

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.