问题
Using Javascript with Nativescript and I am loading a page through code rather than XML.
I have it all working, however I want to add a ScrollView and then place a layout with in that.
How would I go about this?
I have tried:
var scroll = new ScrollView();
var stackLay = new StackLayout();
stackLay.addChild(stuff);
....
scroll.addChild(stackLay);
However, I get error "scroll.addChild is not a function"
Thanks.
回答1:
ScrollView
is not a layout but inherited from ContentView
, therefore you can't add more than one child.
Try
scroll.content = stackLay;
来源:https://stackoverflow.com/questions/52749994/nativescript-add-scrollview-through-code-javascript