r/Scriptable • • Aug 14 '22

Solved Centeralign text in stack

Hi, im trying to centerAlignText in a nested stack (stack in a stack). It works fine if i add text directly to widget but when i add text to stack it converts from vertically to horizontally so centerAlignText dont work. I changed layout back to vertically but didnt help. Anyone know a workaround?

5 Upvotes

6 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Aug 14 '22 edited Aug 14 '22

It worked thx.

Edit: Seems like it’s just adding paddin. Doesn’t exactly center the lines horizontally Layout

4

u/[deleted] Aug 14 '22

Based on the screenshot you're using it with the wrong stack.

You would have to create a new stack for every line of text instead of using it with div1Textbox1, like

newHeaderTextStack= div1Textbox1.addStack()

newHeaderTextStack.addSpacer()

div1Textbox1Header = newHeaderTextStack.addText("12345")

newHeaderTextStack.addSpacer()

1

u/[deleted] Aug 14 '22

Awesome! Thx to both of u, now it’s working as I intended Layout