初始化代码
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package com.qxcm.moduleutil.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/5/17.
|
||||
*/
|
||||
|
||||
public class ScrollViewPager extends ViewPager {
|
||||
private boolean scroll = true;
|
||||
|
||||
public ScrollViewPager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public ScrollViewPager(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public void setScroll(boolean scroll) {
|
||||
this.scroll = scroll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollTo(int x, int y) {
|
||||
super.scrollTo(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent arg0) {
|
||||
/*return false;//super.onTouchEvent(arg0);*/
|
||||
if (scroll)
|
||||
return false;
|
||||
else
|
||||
return super.onTouchEvent(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent arg0) {
|
||||
if (scroll)
|
||||
return false;
|
||||
else
|
||||
return super.onInterceptTouchEvent(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentItem(int item, boolean smoothScroll) {
|
||||
super.setCurrentItem(item, smoothScroll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentItem(int item) {
|
||||
super.setCurrentItem(item);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user