Skip to content

Instantly share code, notes, and snippets.

@dawsontoth
Created February 22, 2011 19:34
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save dawsontoth/839218 to your computer and use it in GitHub Desktop.
Save dawsontoth/839218 to your computer and use it in GitHub Desktop.
Vertical Scrollable View
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var rotate = Ti.UI.create2DMatrix().rotate(90);
var counterRotate = rotate.rotate(-180);
var scrollView = Titanium.UI.createScrollableView({
views:[
Titanium.UI.createImageView({ image:'default_app_logo.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_ui.png', transform: counterRotate }),
Titanium.UI.createImageView({ image:'KS_nav_views.png', transform: counterRotate })
],
showPagingControl:true,
width: 480,
height: 320,
transform: rotate
});
win.add(scrollView);
win.open();
@femkevandrooge
Copy link

really nice and just what I was looking for - thanks :-)

@dawsontoth
Copy link
Author

My pleasure!

@m4nu56
Copy link

m4nu56 commented Jul 15, 2011

Yep this helped me too ! Thank's @dawsontoth

@benjaminbarbe
Copy link

Nice, but how did you handle orientation?

I want a ScrollableView in full screen so I put (inversed because of transformation):
height: Ti.Platform.displayCaps.platformWidth, width: Ti.Platform.displayCaps.platformHeight

It works on the first time, but not after orientation change. Have you any advices for this use case?

Thanks

@dawsontoth
Copy link
Author

Handle the orientation change event. Resize the scrollable view.
http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Gesture.orientationchange-event.html

@benjaminbarbe
Copy link

Yes, thank you! It works fine on iOs.
But not on Android, the gesture events are completely inversed. And I think it can be other problems.

Do you have tried on Android before?

Thanks again!

@dawsontoth
Copy link
Author

Search around on Jira for an answer to that: https://jira.appcelerator.org/browse/TC

@sabmark
Copy link

sabmark commented Sep 20, 2012

Thank you dawsontoth, this helps a lot.

@kinshukchoubisa
Copy link

var scrollableView = Titanium.UI.createScrollableView({
showPagingControl: true,
showVerticalScrollIndicator:true,
currentPage: currentPage,
cacheSize: 3,
views: webViews,
width: Titanium.Platform.displayCaps.platformWidth,
maxZoomScale:2.0,
touchEnabled:true,
contentHeight:'auto',
});

I want to scroll horizontal and vertical with zoom . what can i change in code ?

@chmiiller
Copy link

hey, any news about android version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment