Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含一些项目的 ViewGroup。一旦我向上滚动该 ViewGroup,我想在活动底部显示一个布局,否则将其隐藏。问题是:如何从 ViewGroup 捕获向上/向下滚动事件?
干杯,
看看在ViewGroup 中管理触摸事件。
我相信
case MotionEvent.ACTION_MOVE: { if (mIsScrolling) { // We're currently scrolling, so yes, intercept the // touch event! return true; } }
就是你要找的。
可能,这个 ViewGroup 在 ScrollView 内?您可以覆盖 ScrollView 的 onOverScrolled。