【问题标题】:Nativescript Add ScrollView through Code (Javascript)Nativescript 通过代码添加 ScrollView (Javascript)
【发布时间】:2018-10-10 23:12:36
【问题描述】:

将 Javascript 与 Nativescript 结合使用,我通过代码而不是 XML 加载页面。

一切正常,但我想添加一个 ScrollView,然后在其中放置一个布局。

我该怎么做?

我试过了:

var scroll = new ScrollView();
var stackLay = new StackLayout();

stackLay.addChild(stuff);
....


scroll.addChild(stackLay);

但是,我收到错误“scroll.addChild 不是函数”

谢谢。

【问题讨论】:

    标签: javascript android layout nativescript


    【解决方案1】:

    ScrollView 不是布局而是继承自ContentView,因此您不能添加多个子级。

    试试

    scroll.content = stackLay;
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-13
    • 1970-01-01
    • 2013-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-29
    相关资源
    最近更新 更多