解决滑动冲突问题一般来需要必备的知识:点击事件的分配,滑动距离的判断
一般的解决方法:重写其中一个控件,放弃其中一个滑动事件
1、ScrollView 与 RecyclerView的滑动冲突
public class ScrollRecycleView extends RecyclerView {
public ScrollRecycleView(Context context) {
super(context);
}
public ScrollRecycleView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public ScrollRecycleView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
2、ScrollView与WebView的滑动冲突
这个简直想也没想到。。。在网上找到了几个相关解决方法,在我的方案里,方案1适用,其他两个并没有尝试
参考1:http://www.jianshu.com/p/d21989bea448
参考2:http://blog.csdn.net/kyleceshen/article/details/50381320
参考3:http://blog.csdn.net/bdemq/article/details/46775771
3、ViewPager的滑动冲突
参考:http://blog.csdn.net/itjianghuxiaoxiong/article/details/44938305
后续再遇到滑动冲突问题会进行更新,也欢迎读者建议。