Limited Swipe Area Android -


i need limit swipe area inside viewpager. example, if user make gesture swipe on top half space of screen swipe next fragment, if user make gesture on bottom half of screen nothing.

there way that?

this might need:

public class mypager extends viewpager {     public mypager(context context) {         super(context);     }      public mypager(context context, attributeset attrs) {         super(context, attrs);     }      @override     public boolean onintercepttouchevent(motionevent ev) {         if(inneutralarea(ev.getx(),ev.gety())){             //--events re-directed viewpager's ontouch() , child views there--             return false;          }else {             //--events intercepted viewpager's default implementation, looks swipe gestures--             return super.onintercepttouchevent(ev);         }     }      private boolean inneutralarea(float x, float y) {         //--check if x,y inside non reactive area, return true/false accordingly--         return false;     }  } 

use mypager class in layout xml in place of viewpager.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -