align scroll

24 Aufrufe
Direkt zur ersten ungelesenen Nachricht

avazqu...@gmail.com

ungelesen,
11.07.2017, 06:56:4511.07.17
an PlayN
Hi all! 
I have a group of toggle Buttons with scroll. The problem is that the align is center but I want align right. I set the stlye aling to right but it don't work...



grid.add(new ToggleButton("Maiz",(Icons.image(plat.assets().getImage("images/Maiz.png")))).setStyles(Style.ICON_POS.left, Style.HALIGN.right).addStyles(Style.FONT.is(new Font("Arial", 22))));
       grid.add(new ToggleButton("Brocoli",(Icons.image(plat.assets().getImage("images/Brcoli.png")))).setStyles(Style.ICON_POS.left, Style.HALIGN.right).addStyles(Style.FONT.is(new Font("Arial", 22))));
...
More ToggleButton...
...

   Scroller scroller = new Scroller(grid).setBehavior(Scroller.Behavior.VERTICAL).setStyles(Style.HALIGN.right);
   root.add(AbsoluteLayout.at(scroller, 0, 20, size().width(), size().height()-20)).setStyles(Style.HALIGN.right);
 


Thanks!
Regards!

Michael Bayne

ungelesen,
11.07.2017, 13:25:2311.07.17
an pl...@googlegroups.com
What is the layout on the grid? That's what will control whether the toggle buttons are aligned left or right in the container. The HALIGN property on the toggle buttons themselves just controls what happens to the button label when the button is wider than the label and hence the label could be left or right aligned inside the button.

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Michael Bayne

ungelesen,
11.07.2017, 13:34:5511.07.17
an pl...@googlegroups.com
For example, this code:

Inline image 1

will result in a layout like this:

Inline image 2

The label and group are themselves in a layout which stretches everything the full width. The label defaults to center alignment, which is why it is center aligned, and the nested group has right alignment, so it aligns the buttons on the right. There is no alignment *on the buttons* because that does not apply here.

We could instruct the group to equalize the width of the buttons:

Inline image 3

and now the label inside the buttons has extra room and defaults to center alignment (like the "Axis Layout" label):

Inline image 4

We can finally then apply a right alignment to the buttons themselves and see that it affects the label inside the button:

Inline image 5

Inline image 6

avazqu...@gmail.com

ungelesen,
11.07.2017, 18:13:1411.07.17
an PlayN

Thanks!

I have others question.

1 - How can I make the toggle button fit the size of the layout and not the length of the text?

2 - I want simulate a List of selectable object (Like a listview).
I had thought of doing it as a tooglebutton group and modify the style.

Would it be correct to do so? If I am not mistaken in tripleplay there is no listview

To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michael Bayne

ungelesen,
12.07.2017, 11:55:0812.07.17
an pl...@googlegroups.com
You should look at the examples in the widget demo:

http://threerings.github.io/tripleplay/widgetdemo.html

Look at the source code as it will show you how to do many different things with the UI.

To unsubscribe from this group and stop receiving emails from it, send an email to playn+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten