Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How to implement image slider for android?

Hi.
i have been creating an image slider for android, but i am not achieving what i wanted.
i am doing this-

1.) Creating an array of image views (like this)

var viewArr = [];
for(var j=0;j<path.length;j++){
var imgv = Titanium.UI.createImageView({url:"../images/"+path[j]});
viewArr.push(imgv);
}

(the array path[] is having image names)

2.) Create a new ScrollView with createScrollView (like this)

var scrollView = Titanium.UI.createScrollableView({
     views:viewArr,
});

3.) Pass that array of image views to the ScrollView (in the above code)

5.) Registering the ScrollView for scroll events (like this)

scrollView.addEventListener('scroll', function(e)
{
    Ti.API.info('x'+e.x+'y'+e.y);
});

but it doesn't seem to work as whenever i scroll , i get nothing.
please help.
i have seen kitchen sink app's scroll_view_tab.js and have tried to implement it too, but no positive results.

— asked April 17th 2010 by Aman Alam
  • android
  • image
  • scroll
  • slider
  • view
0 Comments

1 Answer

  • Hi

    I’ve done some code research on creating an Android image carousel. Hope it helps answer your question on implementing an image slider. Please let me know if there’s anything I can add to make a more comprehensive resource for other developers.
    http://www.verious.com/board/Giancarlo-Leonio/creating-an-android-image-carousel/

    @Veriously

    — answered March 6th 2013 by Giancarlo Leonio
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.