【发布时间】:2013-09-23 07:07:33
【问题描述】:
我在滚动视图中有 10 个图像视图
点击图片后,我想执行一个操作
但是当我尝试滚动 ScrollView 中的图像时,Touch_down 和 Touch_UP 一起被视为单击
帮帮我 我知道解决方案很简单 但我认为我缺少一些逻辑
我把我的代码放在这里
public class CustomScrollView extends ScrollView {
public CustomScrollView(Context context) {
super(context);
}
public CustomScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
@Override
public boolean onTouchEvent(MotionEvent p_event) {
if (p_event.getAction() == MotionEvent.ACTION_MOVE && getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(true);
}
return super.onTouchEvent(p_event);
}
}
在这个 ScrollView 中我添加了一个 ImageView
【问题讨论】:
-
请大家提出一个不使用 ListView 的解决方案
-
没有代码没人能帮你
-
添加ImageView的代码在哪里?
标签: android onclick scrollview touch-event