Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jedashford
Level 7

Can text be centered in a Scene Graph Button?

See image below. The button node doesn't seem to allow me to center the text. Even when I add empty spaces "    " they are trimmed away. The first two buttons have spaces and a period so I can test my trimming theory. Am I looking passed something simple? 

0 Kudos
5 Replies
belltown
Level 7

Re: Can text be centered in a Scene Graph Button?

I have a ButtonGroup with buttons that are centered. I'm not sure if there's an easier way:


buttons="["   Play   ","   Stop   "]"
https://github.com/belltown/
0 Kudos
jedashford
Level 7

Re: Can text be centered in a Scene Graph Button?

Thank you. I'll give this a try. I'm worried a solution like this wont scale well with different screen resolutions. We'll find out...
0 Kudos
joetesta
Level 10

Re: Can text be centered in a Scene Graph Button?

"jedashford" wrote:
Thank you. I'll give this a try. I'm worried a solution like this wont scale well with different screen resolutions. We'll find out...

I think I got this to work by having a Label that's a child element of the button, (and the same width) and the label text can be centered with;
<Label id="itemLabel" horizAlign="center" />
aspiring
0 Kudos
jedashford
Level 7

Re: Can text be centered in a Scene Graph Button?

"joetesta" wrote:
I think I got this to work by having a Label that's a child element of the button, (and the same width) and the label text can be centered with;
<Label id="itemLabel" horizAlign="center" />


Thats the key. Works like a charm.
0 Kudos
nmaves
Level 7

Re: Can text be centered in a Scene Graph Button?

Can I ask how you created this horizontal button group?  I am having a heck of a time creating something very simular to this.
0 Kudos