鞋子布局
我正在尝试生成如下所示的鞋子布局:
示例 GUI 布局 http://csclub .uwaterloo.ca/~s3weber/gui.png
文本给我带来了问题。 我尝试过:
stack {
flow {
check
stack {
para 'text 1'
para 'text 2'
}
para 'Free'
}
}
但这根本不起作用。 有任何想法吗?
I'm trying to produce a shoes layout like the following:
example GUI layout http://csclub.uwaterloo.ca/~s3weber/gui.png
the text is giving me a problem. I tried:
stack {
flow {
check
stack {
para 'text 1'
para 'text 2'
}
para 'Free'
}
}
But that doesn't work at all. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否正确设置了所有元素的宽度?
Did you set the widths of all elements properly?
在粒子中,对于后来的访问者,您需要设置流内堆栈的宽度,否则它将处于宽度 100%,并且 check 和 para 将被推送到它们自己的行。 像这样的东西效果很好,添加了边框来可视化盒子。
将堆栈的宽度设置为 -80 允许它使用行中的所有空间,并为其他组件留下 80 像素,这似乎是此类应用程序所需的行为。
另请注意,当您将隐式散列参数与大括号分隔的块结合使用时,Ruby 会感到困惑,因此您要么需要像我这里那样使用 do..end ,要么将要堆栈的参数括在括号内。
In particle, for later visitors, you need to set the width of the stack inside the flow because otherwise it will be at width 100% and the check and para will be pushed to their own rows. Something like this works great, with an added border to visualize the box.
Setting the width of the stack to -80 allow it to use all of the space in the row and leave 80 pixels for the other components, which appears to be the desired behavior for an app like this.
Note also that Ruby is confused when you use an implicit hash parameter in conjunction with a block delimited by braces, so you either need to use do..end as I have here or enclose the parameters to stack inside of parentheses.