Home键关闭 [英] Home button disable

查看:195
本文介绍了Home键关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是病了建议采取对用户的Home键控制。但我正在开发用于教育目的的Andr​​oid应用程序锁定。我在浏览网站的时候来到这个<一href="http://stackoverflow.com/questions/2162182/android-is-it-possible-to-disable-the-click-of-home-button">link在禁用home键。

  @覆盖

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

目前我使用的是上面的code禁用我的home键,然而,我发现,即使我有这个在我的onCreate

<$p$p><$c$c>getWindow.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

我无法删除我的通知栏中删除。 请指点。

解决方案

只需使用一个不同的主题,为您的活动。在您的Manifest.xml,设置活动的主题属性的android:主题=@安卓风格/ Theme.NoTitleBar.Fullscreen

I do know that it is ill advice to take control of the HOME button for users. But I'm developing a android lockdown application for educational purposes. I was browsing the site and came upon this link on disabling the home button.

@override

public void onAttachedToWindow()
{  
       this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);     
       super.onAttachedToWindow();  
}

Currently I'm using the above code to disable my home button, however I do notice that even though I have this in my onCreate

getWindow.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

I am unable to remove my notification bar remove. Please advice.

解决方案

Just use a different theme for your activity. In your Manifest.xml, set the theme attribute of your activity to android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

这篇关于Home键关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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