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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -