如何禁用Android 4.0的主页按钮? [英] How can I disable Android 4.0 home button?

查看:175
本文介绍了如何禁用Android 4.0的主页按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以禁用的主页按钮为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); 
}

解决方案

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

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