android - ViewPager without swipe and pass the swipe to parent TabLayout -


i have nested viewpager in fragment. , want manually switch fragment inside viewpager. managed successfully.

i disable swipe doing this.

public class nonswipeableviewpager extends viewpager {      public nonswipeableviewpager(context context) {         super(context);     }      public nonswipeableviewpager(context context, attributeset attrs) {         super(context, attrs);     }      @override     public boolean onintercepttouchevent(motionevent event) {         // never allow swiping switch between pages         return false;     }      @override     public boolean ontouchevent(motionevent event) {         // never allow swiping switch between pages         return false;     } } 

the problem when this. disable swipe of parent tabs.

any idea?

remove overrides onintercepttouchevent() , ontouchevent() , use instead:

@override public boolean canscrollhorizontally(int direction) {     return false; } 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -