javascript - How to detect scroll event on a ListView? -
does know of way detect vertical scroll/swipe gesture on listview? tried listening swipe event fires on left-to-right , right-to-left gestures, not or down. tried listening on parent view resulted in same behavior. in advance tips or tricks! :)
it doesn't seem supported, 1 way set list views height ti.ui.size not scroll, , put inside scrollview. listen scroll
event on scrollview. try this:
// vertical scroll view var parentscrollview = ti.ui.createscrollview({ height : 'auto' }); // make list view not scroll var listview = ti.ui.createlistview({ height : ti.ui.size, ... other initialization here ... }); parentscrollview.add(listview); parentscrollview.addeventlistener('scroll', function(e) { // lets know scrolled var scrollx = e.x; var scrolly = e.y; // alternatively use contentoffset var contentoffsetscoped = e.source.contentoffset; var contentoffsetsame = parentscrollview.contentoffset; });
this minimalist example, works. note approach may take away performance gains listview control might better convert using tableview.
Comments
Post a Comment