/** * 自定义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; } }
scrollview与手势冲突如何解决
最新推荐文章于 2021-07-26 12:03:12 发布