我创建了一个SkinnableContainer运行时,因为我想为它设置一些样式属性,然后基于我需要创建一个新的SkinnableContainer并将其作为第一个子项添加的一些外部数据。这个子高度可以大于父容器。
如何使用某些滚动条创建SkinnableContainer运行时? 我read in the documentation that I need to create a new Skin。
运行时可能会达到相同的效果吗?
// ... in a container ...
var father = new SkinnableContainer();
this.addElement(father);
var child = new SkinnableContainer();
// ... some initialization... child is filled with some other elements from outside
father.addElement(child);
// ... now if child.height > father.height
// I want to add a vertical scrollbar
答案 0 :(得分:2)
您始终可以将孩子置于Scroller
控件中。
例如:
var father = new SkinnableContainer();
this.addElement(father);
var scroller = new Scroller();
var child = new SkinnableContainer();
// ... some initialization... child is filled with some other elements from outside
// scroller.addElement(child); // wrong because you cannot add element to a scroller
scroller.viewport = child.contentGroup; // but you can set this to an IViewport
father.addElement(scroller);
father.addElement(child);