标签:android开发
要实现viewpager的滑动以及禁止滑动切换功能只需要继承viewpager,在onTouchEvent进行逻辑判断即可(网上搜到的,确实可行,原创地址不明),下面自己实现一个
public class MyViewPager extends ViewPager { private boolean scrollble=true; public MyViewPager super(context); } public MyViewPager(Context context, AttributeSet attrs) { super(context, attrs); } @Override public boolean onTouchEvent(MotionEvent ev) { if (!scrollble) { return true; } return super.onTouchEvent(ev); } public boolean isScrollble() { return scrollble; } public void setScrollble(boolean scrollble) { this.scrollble = scrollble; } }
标签:android开发
原文地址:http://blog.csdn.net/cml_blog/article/details/41577281