android - Dispatch touch events to ViewPager's unfocused fragments -
i've implemented dave smith's elegant solution displaying multiple views inside viewpager here, having trouble dispatching touch events fragments not "focused" one.
in pagercontainer solution, there functionality handle touch events outside of viewpager's focused area (see below), that's enable scrolling. need touch events interact views on fragments themselves.
does have experience this?
@override public boolean ontouchevent(motionevent ev) { //we capture touches not handled viewpager // implement scrolling touch outside pager bounds. switch (ev.getaction()) { case motionevent.action_down: minitialtouch.x = (int)ev.getx(); minitialtouch.y = (int)ev.gety(); default: ev.offsetlocation(mcenter.x - minitialtouch.x, mcenter.y - minitialtouch.y); break; } return mpager.dispatchtouchevent(ev); }
how touch events pagercontainer propagated appropriate fragment?
you can use event bus purpose checkout link how use it.i have used kind of communications between activities , fragments. https://github.com/greenrobot/eventbus
Comments
Post a Comment