scrollview与手势冲突如何解决

/**
* 自定义ScrollView,并重写其onTouch<a target=_blank target="_blank" href="https://www.baidu.com/s?wd=Ev&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3uANhnW99uWTdP1bsmHnz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1D4nWfsnWD1rj6snH6dPHT1PjT" class="baidu-highlight" style="color: rgb(45, 100, 179); text-decoration: none;">Ev</a>ent和dispatchTouch<a target=_blank target="_blank" href="https://www.baidu.com/s?wd=Ev&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3uANhnW99uWTdP1bsmHnz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1D4nWfsnWD1rj6snH6dPHT1PjT" class="baidu-highlight" style="color: rgb(45, 100, 179); text-decoration: none;">Ev</a>ent方法,
* 以解决viewflipper 与scrollview的手势冲突
* @author yangjiantong
*
*/
public class MyScrollView extends ScrollView {
        GestureDetector gestureDetector;
        public MyScrollView(Context context) {
                super(context);
                // TODO Auto-generated constructor stub
        }
        public MyScrollView(Context context, AttributeSet attrs) {
                super(context, attrs);
                // TODO Auto-generated constructor stub
        }
        public MyScrollView(Context context, AttributeSet attrs, int defStyle) {
                super(context, attrs, defStyle);
                // TODO Auto-generated constructor stub
        }
        public void setGestureDetector(GestureDetector gestureDetector) {
                this.gestureDetector = gestureDetector;
        }
        @Override
        public boolean onTouch<a target=_blank target="_blank" href="https://www.baidu.com/s?wd=Ev&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3uANhnW99uWTdP1bsmHnz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1D4nWfsnWD1rj6snH6dPHT1PjT" class="baidu-highlight" style="color: rgb(45, 100, 179); text-decoration: none;">Ev</a>ent(MotionEvent ev) {
                // TODO Auto-generated method stub
                super.onTouchEvent(ev);
                return gestureDetector.onTouchEvent(ev);
        }
        @Override
        public boolean dispatchTouchEvent(MotionEvent ev){
                gestureDetector.onTouchEvent(ev);
                super.dispatchTouchEvent(ev);
                return true;
        }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值