重写一个ScrollView

public class MyScrollView extends ScrollView{
        

        public MyScrollView(Context context, AttributeSet attrs, int defStyle) {
                super(context, attrs, defStyle);
        }

        public MyScrollView(Context context, AttributeSet attrs) {
                super(context, attrs);
        }

        public MyScrollView(Context context) {
                super(context);
        }
        
        
        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
                
        return false;
        }

}

由于事件先由ScrollView获得,所以要重写ScrollView,把事件传递给它的子控件,所以 重写onInterceptTouchEvent 方法,返回false。就可以把事件传给子控件了

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2021-09-20
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案