Kodi Community Forum
"centerleft" doesnt work for a Button with auto width, workaround? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: "centerleft" doesnt work for a Button with auto width, workaround? (/showthread.php?tid=351699)



"centerleft" doesnt work for a Button with auto width, workaround? - TP.One - 2020-02-13

Hello

What i try to achive is a line underneath a Text with the exact length of the Text. As this seems not possible by default, my idea was to use a button with "auto" width, which holds the same Text as the label. to scale the texture to the exact text length. (which works.)

Now the Problem: I can easely center the text, but struggle to center the Button underneath, (which holds the Texture). my idea was to use <centerleft>50%</centerleft> to position the Button (But this seems to work only with a integer width).

Does may someone have a Idea how to solve this? Dont have to be the "Button aproach", just Looking for a solution to have a Text underlined with the exact label length.

reg.


RE: "centerleft" doesnt work for a Button with auto width, workaround? - jurialmunkey - 2020-02-14

Try putting the button inside a horizontal grouplist with <align>center</align>

e.g.
xml:

<control type="grouplist">
<orientation>horizontal</orientation>
<align>center</align>
<control type="button">
<width>auto</width>
</control>
</control>

I'm not 100% sure if it works but from memory I think it might.


RE: "centerleft" doesnt work for a Button with auto width, workaround? - TP.One - 2020-02-14

Thanks, works!

would (have) be cool if there would be something which work inside of a list, would have reduce the efford! (thers nothing a could think of)
I knew, just use a button inside a list is (already) "evil".

Currently not shure if the effect is worth it to fiddle around thurder with animations to make it look good, so i may leave it "as is".

Thanks for the "Grouplist hint"!

reg.