与View.GONE的Andr​​oid浏览仍接收onTouch和的onClick [英] android View with View.GONE still receives onTouch and onClick

查看:226
本文介绍了与View.GONE的Andr​​oid浏览仍接收onTouch和的onClick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是困惑我:

据我已阅读,一个视图setVisibility(View.GONE);应该不再接收任何触摸或单击事件。 我的设计有两个部分,这将是可见的或消失,使其中只有一个是可见的和可用的时间,但View.GONE不会做的伎俩。 我看不到逝去的观点,如预期,但它仍然反应的onClick(并消耗该事件的另一种观点应该得到)。

As far as I have read, a view with setVisibility(View.GONE); should not receive any more touch- or click events. My layout has two parts, which will be visible or gone so that only one of them is visible and usable at a time but View.GONE doesn't do the trick. I can't see the GONE view, as expected, but it still reacts to onClick (and consumes the event the other view should get).

您能帮我吗?

可能感兴趣的: 当我开始我的项目一个视图中消失了,其他可见。这一次,它会按预期工作(逝去的观点基本上是忽略不计),但设置View.GONE通过code,它会停止工作后。

Maybe of interest: When I start my project one view is GONE, the other visible. This time it will work as expected (the GONE view is basically ignored), but after setting View.GONE through the code it'll stop working.

推荐答案

你也许用动画来显示/隐藏意见?我得到这个行为,当我使用有机器人动画:fillEnabled =真正的机器人:fillAfter =真 不明白它,似乎是一个错误 - 如果我使用的动画没有fillEnabled / fillAfter,预期所有的作品...

Do you maybe use animations to show/hide the views? I get this behaviour when I use animations that have android:fillEnabled="true" android:fillAfter="true" Don't understand it, and seems like a bug - if I use animations without fillEnabled/fillAfter, all works as expected...

这篇关于与View.GONE的Andr​​oid浏览仍接收onTouch和的onClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆