android - animate list view divider -
scenario: need line between items in list view , want apply animation (like slide left).
well, customized list view divider. wanted animate it.
is there possible way?
if not, suggest alternative.
you better add divider row layout handle it. display each row in listview then, use ontouchlistner
on dividerobject (linearlayout) initialize gesture class
:
_dividerrow.setontouchlistener(new mygesturelistener() ); class mygesturelistener implements ontouchlistener { private pointf _init; @override public boolean ontouch(view v, motionevent event) { switch(event.getaction()) { case motionevent.action_down : _init = new pointf(event.getrawx(), event.getrawy()); if(!(v == null)) { _velocitytracker = velocitytracker.obtain(); _velocitytracker.addmovement(event); } break; case motionevent.action_up : break; case motionevent.action_move : if(leave == false) { if(event.getx() > 0) { _velocitytracker.addmovement(event); float diffx = event.getrawx() - _init.x; float diffy = event.getrawy() - _init.y; if (math.abs(diffx) > _slop && math.abs(diffx) > math.abs(diffy)) { _swipping = true; ((viewgroup) v).requestdisallowintercepttouchevent(true); motionevent cancelevent = motionevent.obtain(event); cancelevent.setaction(motionevent.action_cancel | (event.getactionindex() << motionevent.action_pointer_index_shift)); v.ontouchevent(cancelevent); } if(_swipping == true) { viewhelper.settranslationx(v, diffx); } } } break; } return false; } }
hope helps
Comments
Post a Comment