Android TouchImageView内部滚动视图
我在ScrollView中有一个TouchImageView,但当我缩放imageview并尝试向上/向下滑动时,响应来自ScrollView。Android TouchImageView内部滚动视图,android,scrollview,touchimageview,Android,Scrollview,Touchimageview,我在ScrollView中有一个TouchImageView,但当我缩放imageview并尝试向上/向下滑动时,响应来自ScrollView。 当我触摸TouchImageView时,是否有任何方法停止滚动视图您可以调用RequestDisallowWinterCeptTouchEvent(true)禁用scrollview的操作滚动 YourImageview.setOnTouchListener(new View.OnTouchListener() { @Override
当我触摸TouchImageView时,是否有任何方法停止滚动视图您可以调用
RequestDisallowWinterCeptTouchEvent(true)代码>禁用scrollview的操作滚动
YourImageview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
// Disallow ScrollView to intercept touch events.
scrollView.requestDisallowInterceptTouchEvent(true);
// Disable touch on transparent view
return false;
case MotionEvent.ACTION_UP:
// Allow ScrollView to intercept touch events.
scrollView.requestDisallowInterceptTouchEvent(false);
return true;
case MotionEvent.ACTION_MOVE:
scrollView.requestDisallowInterceptTouchEvent(true);
return false;
default:
return true;
}
}
});
@MohammadIshker欢迎您,如果这个答案是接受的,请批准