android - ViewPager block forward on page -


There are a lot of questions and solutions that how to block swipe in a ViewPager.

Example:

However, I would like to block the block that swipe only on a specific page (I have a form and register button, which shows the next page as a programm Is)

Example: Page 1 -> Swipe and Lieutenant; - Page 2 -> Swipe and Lieutenant; - Page 3 (Form) -> Button -> Page 4

Do not get the button to work because everything is read as a motion avant. ACTIVOVOVE is not aware that when the event is wrong to go or to go,

  

Import android.content.Context; Import android.support.v4.view.ViewPager; Import android.util.AttributeSet; Import android.view.MotionEvent;

The public category customviewpixer enhances the viewpace {

Private Boolean enabled; Private boolean blockSwap = false;

Public CustomViewPager (Reference Reference, Attribatets Atters) {Super (References, ethers); This.enabled = true; }

@ Override Public Boolean on Touch Event (Motion Event Event) {If (This Non Resident) {Return SuperTontatch (Incident); }

return false; }

Public Zero Set BlockSwop (Boolean Block Sweep) {this.blockSwipe = blockSwipe; }

Override the public boolean (motion event event) at @InverceptTouchEvent {if (block Skype) returns incorrectly; And in turn super.onInterceptTouchEvent (event); }

}


Comments