如何将组件放置在另一个组件的前面?
我想将组件 A 和 B 放置在带有 List 的组件上。我需要列表文本可见。我找不到哪个布局可以做到这一点。 lwuit 中的这种行为如何?存在哪些解决方案?
I want to place the components A and B over component with List. I need that would text of list will be to visible. I can not find which layout can do it.
How this behavior is in lwuit? What solutions exist?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题有点不清楚,如果您希望组件的 A 和 B 位于屏幕底部并且列表滚动到上方,则 jmunoz 的答案是正确的。然而,从图中看来,您似乎想要一种“始终在顶部”的效果,您可以通过玻璃窗格(对于非交互式组件)或通过 LayeredLayout 类来实现。
使用以下命令实际上非常简单:
The question is somewhat unclear, jmunoz answer is correct if you want component's A and B to reside at the bottom of the screen and the list to scroll above. However from the drawing it seems you want an "always on top" effect which you can achieve either via a glass pane (for non-interactive components) or via the
LayeredLayout
class.This is actually quite simple using the following:
您必须执行以下操作:
Form
不得滚动。使用Form.setScrollable(false)。将“Form”的布局设置为BORDER_LAYOUT
、myForm.setLayout(new BorderLayout())
。好的,在BorderLayout
中,您可以根据需要将组件放入Form
中。将
List
组件放在BorderLayout
的中心,用myForm.addComponent(BorderLayout.CENTER, List)
将另外两个元素放在南边使用此布局,您可以获得一个可滚动的列表和两个始终可见的元素。
You must do the following:
The
Form
must not do scroll. UseForm.setScrollable(false)
. Set the layout of the ´Form´ toBORDER_LAYOUT
,myForm.setLayout(new BorderLayout())
. Ok inBorderLayout
you can put the components in theForm
as you want.Put the
List
component in the center of theBorderLayout
withmyForm.addComponent(BorderLayout.CENTER, List)
and the other two elements in the south of the layout usingWith this you can get a scrollable
List
and two elements always visible.