我正在制作一个应用程序,我们可以将一个视图拖到另一个视图上。下面的视图有一个触摸侦听器,但当我将顶部视图移到它上面时,它会丢失。它挂了一点,但顶视图没有问题。
因此我的问题是,当我们将一个视图放在另一个视图上时,听众会受到影响吗?
发布于 2015-07-22 06:13:20
是的,确实如此。
检查以下OnTouchListener
示例:
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY)
{
// do some thing
return true; // when you return true here event will not propagate to views those
// are in lower hierarchy. Means inside views will not be able to consume onFling event
}
https://stackoverflow.com/questions/31555093
复制