2014-10-07 75 views
1

滚动我很新的libGDX并试图实现下面使用table layoutlibx中的GDX具有圆形覆盖

容器一个表在图中所示的布局[绿色]由表头的 [蓝色]和ScrollPane 机身 [黑色项目]。身体也是各种各样的行。

我想要正文部分滚动“下”标头。在开始时,从主体的所有项目应该可以看到一个适当的填充。

到目前为止的代码:

ScrollPane body = new ScrollPane(bodyTable); 
header.add(headerBar).expandX().fillX();  
container.add(header).top().expandX().fillX().row(); 
container.add(body).fill().expand(); 

[注意,所需的纹理不包括在所述文档片断。

它可以正常滚动但就像是一个横向切身体,而我想有像一个圆的效果。奇迹是可以使用表吗?有没有任何示例/建议可以将我指向正确的方向?

enter image description here

+0

我认为你需要两个兄弟表,它们都填充父项,一个用于标题,一个用于正文。将足够的填充放在身体桌面的顶部,以便在标题下可以看到第一行。 – Tenfour04 2014-10-07 17:26:15

回答

0

有一点我设法有一个工作版本。

在Scene2d中有Stack widget这是设计将一个项目堆叠在另一个上。

层次结构的概要是:

Stack container = new Stack; 
// the container is using all the available space 
container.setFillParent(true); 
container.add(body); 
container.add(head); 
stage.addActor(container); 

棘手的部分是定义既内部的元件的正确位置。

所以对于我在执行我有类似:

Table header = new Table(); 
Table header_container = new Table(skin); 

// assign a background behind the header contents 
Drawable tableBackground = skin.getDrawable("top_bg"); 

//some position tweaks to resize the background to the wanted height 
tableBackground.setMinHeight(10); 
tableBackground.setBottomHeight(30); 
tableBackground.setTopHeight(10); 
header_container.setBackground(tableBackground); 

// headerBar is another table that contains the buttons that are in the header 
header.add(headerBar).expandX().fillX(); 
header_container.add(header).expandX().fillX(); 
head.addActor(header_container); 

是包含表一ScollPane。内部表有一个Top Padding,因此它在开始时是完全可见的。当滚动它在标题部分下并隐藏一点。

它正在工作,但觉得有太多的嵌套涉及,如果我发现一个更清洁的解决方案将更新上面的代码。

0

我想帮助,但我的腹股沟很难理解我很好,你想让它在例如头部保持在原位,而其他移动按钮,例如表。

http://i.stack.imgur.com/C9cwR.png

1-附加窗口表和table.row();

2-将其他窗口添加到表中并添加滚动条。

不会,如果这就是你的意思。

+0

@dawez http://i.stack.imgur.com/C9cwR.png – 2014-10-07 17:44:30