“返回”异常时的按钮用过的
当我接近完成我的项目时,我遇到了一个非常奇怪的效果。我将该行引入
<uses-sdk android:minSdkVersion="8" />
到清单中,并在模拟器和手机 (HTC Desire) 中重新运行该项目。我注意到“后退”按钮在程序的许多区域都不起作用。当我将代码放入调试中时,onKeyDown
侦听器正常触发[并将 ok 传递给 super.onKeyDown(..)
],而 onBackPressed
code> 监听器根本没有触发。
当我从清单中删除 uses-sdk
条目时,一切都恢复正常。谁能解释一下,因为我真的需要使用 min-sdk
语句。
更新: 我已经尝试了 min-sdk="1"
(默认值),效果是一样的。然后,我删除了 min-sdk 值并使用 target-sdk
值代替,结果完全相同,即后退按钮在所有地方都不起作用。只需删除标签
就可以完全修复效果,但给我带来了在部署之前需要声明最小 sdk 值的问题。请帮忙,某人,任何人...
I have encountered a very strange effect as I get near to finishing my project. I introduced the line
<uses-sdk android:minSdkVersion="8" />
into the manifest and re-ran the project in both the emulator and a phone (HTC Desire). I noticed that the "back" button wasn't operating in a number of areas of the program. When I put the code into debug, the onKeyDown
listener was firing OK [and handed off ok to super.onKeyDown(..)
] whereas the onBackPressed
listener wasn't firing at all.
When I removed the uses-sdk
entry from the manifest all returned to normal. Can anyone explain please because I really need to use the min-sdk
statement.
Update:
I have experimented right down to min-sdk="1"
(the default value) and the effect is the same. I then removed the min-sdk value and used the target-sdk
value instead with EXACTLY THE SAME consequences i.e. the back button won't work in all places. Simply removing the tag <uses-sdk .... />
completely fixes the effect but leaves me with the problem of needing to declare a minimum sdk value before I deploy. Please help, someone, anybody...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许我们遇到了同样的问题。
我使用这种方式来模拟软后退按钮,但是当“min-sdk”时添加后,按钮不起作用。似乎“dispatchKeyEvent”和“min-sdk”有冲突。我用“onBackPressed”代替,它对我来说效果很好。
Maybe we met the same problem.
I use this way to simulate a soft back button, but when "min-sdk" is added, the button doesn't work. It seems like "dispatchKeyEvent" and "min-sdk" are in conflict. I used "onBackPressed" instead, it works fine for me.
为什么不使用onKeyDown?
Why not use onKeyDown?