安卓 : Touch events in layout after animation

标签 android animation touch android-linearlayout user-interaction

我有一个 LinearLayout,其中仅包含一个 ListView。 LinearLayout 填充整个屏幕,而 listView 首先停留在屏幕的底部四分之一。 我将 ListView 的上边距设置为一个大值,以将 listView 保持在屏幕底部。下图可能会帮助您更好地理解我的布局。

enter image description here

现在点击按钮我希望我的listView向上滑动并填充屏幕。我正在使用翻译动画,就像这样

TranslateAnimation animation = new TranslateAnimation(
                    Animation.RELATIVE_TO_SELF,0.0f
                                ,Animation.RELATIVE_TO_SELF, 0.0f
                                ,Animation.RELATIVE_TO_SELF,0.0f
                                ,Animation.RELATIVE_TO_SELF, -0.70f);
animation.setDuration(1000);
animation.setFillAfter(true);
animation.setFillEnabled(true); 
mBottomView.startAnimation(animation);

其中 mBottomView 是我的 ListView 布局。此代码成功地将 listView 动画到顶部。

现在我的问题是,当 listView 填充屏幕时,我尝试滚动, ListView 的触摸事件在 ListView 的原始位置上方无法识别。即,当我触摸黄色空间(图像中)的任何位置来滚动 ListView 时,不会检测到触摸。我可以滚动到 listView 的原始位置下方。这是为什么?

最佳答案

我遇到了同样的问题,这个问题的答案完全定义在这个问题的答案中。 EditText stucks after animation and alive back on scrolling......?

关于安卓 : Touch events in layout after animation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9665312/

相关文章:

android - 检查本地数据存储是否为空

java - PhoneGap - 请求 GPS 激活

android - 在服务中获取触摸事件(坐标、运动事件等)

swift - Swift 中的连续触摸

java - 长时间不活动后无法创建新的加载程序

java - Android Studio中调用jar库

ios - UIView animateWithDuration 在 iOS 8 中表现不同

c# - 如何在 WPF 4 中创建翻转控件?

jquery - 无法仅从嵌套的 ul li 中获取第一级 li

c# - 鼠标事件发送者如何为空? (仅适用于 Windows 8.1+ TOUCH)