ScrollView on mainView
Closed this issue · 5 comments
Hi!
I have trouble creating a scrollView inside the main view (what you see before opening the drawer).
It works everywhere (ex. opening another window) except inside the "main" controller.
<Require src="main" id="mainC"> </Require>
This is my main.xml
<Alloy>
<ScrollView id="testscroll" layout="vertical" backgroundColor="white" showVerticalScrollIndicator="true"></ScrollView>
</Alloy>
my main.js
var containerView = Ti.UI.createView({
height: Ti.UI.SIZE,
layout: "vertical",
borderColor: "blue"
});
var label1 = Ti.UI.createLabel({
text: "MyText",
color: "black"
});
containerView.add(label1);
$.testscroll.add(containerView);
Appreciate your help.
Only iOs or Android?
Sorry, I completly forgot this thread.
I can't test on iOs now
Now I'm using a trick that do the job but that's not a solution: I create a new menu item that links to the scrollView and use setCenterView
I am having the same error: This will work both iOS and Android
main.xml
<Alloy> <View layout="vertical" > <Label>Hi</Label> </View> </Alloy>
But this will only work on iOS and give error on Android:
<Alloy> <ScrollView> <Label>Hi</Label> </ScrollView> </Alloy>
The problems is that I need longer pages so ScrollView is the solution but I am getting this error on Android.
Anyone can help Out? lebrac9 how did you solve this?
Thanks
As I said before, you can put your scrollview in a separate controller. Then, in the index.js call
$.index.setCenterView(Alloy.createController("separeteController").getView());
It works on Android, on iOS try yourself
It's a bit "dirty" but it's something...
Thanks lebrac9 it worked! I did it this way on index.js:
$.index.open();
$.index.setCenterView(Alloy.createController("inicio").getView());