如何禁用Android 4.0的主页按钮? [英] How can I disable Android 4.0 home button?
问题描述
我可以禁用的主页按钮为Android 2.2,3.0等,但同样的code为4.0不起作用。有没有什么解决办法禁用home键?
@覆盖
公共无效onAttachedToWindow()
{
super.onAttachedToWindow();
。this.getWindow()的setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
}
禁用主页按钮,不少开发商问这样的功能!但我可以说:你绝对不应该禁用的主页按钮在Android应用程序。这是一个重大的反模式,然后都将让您的应用程序标记为垃圾邮件和恶意软件如。用户讨厌当你禁用其主页按钮,你应该避免不惜一切代价。这不是违法的要做到这一点,但你的用户会得到生气,你会得到谷歌的低收视率发挥你的应用程序。同时该技术的不再工作在的Android 4.0 ,为明显的安全原因!!
I can disable home button for Android 2.2, 3.0 etc. But same code does not work for 4.0. Is there any solution to disable home button?
@Override
public void onAttachedToWindow()
{
super.onAttachedToWindow();
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
}
Disabling the Home Button, many developers ask about such a feature!! but all I can say: you should absolutely not be disabling the home button in an Android application. This is a major anti-pattern, and will both make your app labelled as spammy and malware-like. Users hate when you disable their home button, and you should really avoid it at all costs. It's not against the law to do this , but your users will get pissed off and you will get a low ratings on google play for your app. Also This technique no longer works in Android 4.0, for obvious security reasons!!
这篇关于如何禁用Android 4.0的主页按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!