如何禁用Android 4.0的主页按钮?按钮、主页、Android

由网友(巴黎铁塔下╮仰望幸福)分享简介:我可以禁用的主页按钮为Android 2.2,3.0等,但同样的code为4.0不起作用。有没有什么解决办法禁用home键?@覆盖公共无效onAttachedToWindow(){super.onAttachedToWindow();。this.getWindow()的setType(WindowManager.L...

我可以禁用的主页按钮为Android 2.2,3.0等,但同样的code为4.0不起作用。有没有什么解决办法禁用home键?

  @覆盖
公共无效onAttachedToWindow()
{
    super.onAttachedToWindow();
    。this.getWindow()的setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
}
 

解决方案

禁用主页按钮,不少开发商问这样的功能!但我可以说:你绝对不应该禁用的主页按钮在Android应用程序。这是一个重大的反模式,然后都将让您的应用程序标记为垃圾邮件和恶意软件如。用户讨厌当你禁用其主页按钮,你应该避免不惜一切代价。这不是违法的要做到这一点,但你的用户会得到生气,你会得到谷歌的低收视率发挥你的应用程序。同时该技术的不再工作在的Andr​​oid 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); 
}
Android Button

解决方案

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!!

阅读全文

相关推荐

最新文章