[TIMOB-7495] Android: disable animation when you manually define scrollableView.currentPage
GitHub Issue | n/a |
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 1.8.0.1, Release 2.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Nikhil Sharma |
Assignee | Eric Merriman |
Created | 2012-02-01T04:33:09.000+0000 |
Updated | 2018-08-02T17:31:54.000+0000 |
Description
Disable animation when you manually define scrollableView.currentPage.
Repo Steps
1.Run the below code in the app.js
2.Scroll through scrollable views.
3.When scroll from right to left, next screen animates from left to right.
4.When scroll from left to right, previous screen animates from right to left.
Please find the code here.
```
var counter = 0;
var colors = ['#ffffff', '#ff0000', '#6699cc', '#aaaaaa', '#cccccc', '#00ff00'];
// create a view with random color
function createView() {
var nextColor = colors[counter++];
var view = Ti.UI.createView({
backgroundColor: nextColor
});
if(counter >= colors.length) {
counter = 0;
}
return view;
}
var win = Ti.UI.createWindow({
});
var scrollView = Titanium.UI.createScrollableView({
views: [createView(), createView(), createView()],
showPagingControl:true,
pagingControlHeight:30,
maxZoomScale:2.0,
currentPage:1
});
scrollView.addEventListener('scroll', function(e) {
if(e.currentPage == 2) {
Ti.API.info("Scrolling to right");
var newView = createView();
scrollView.views[0].backgroundColor = scrollView.views[1].backgroundColor;
scrollView.views[1].backgroundColor = scrollView.views[2].backgroundColor;
scrollView.views[2].backgroundColor = newView.backgroundColor;
}
else if(e.currentPage == 0) {
Ti.API.info("Scrolling to left");
var newView = createView();
scrollView.views[2].backgroundColor = scrollView.views[1].backgroundColor;
scrollView.views[1].backgroundColor = scrollView.views[0].backgroundColor;
scrollView.views[0].backgroundColor = newView.backgroundColor;
}
scrollView.currentPage = 1;
});
win.add(scrollView);
win.open();
{\code}
Comments
JSON Source
No comments