禁用和永久隐藏的Andr​​oid导航栏/菜单的通知 [英] disabling and hiding android navigation bar/notification menu permanently

查看:1454
本文介绍了禁用和永久隐藏的Andr​​oid导航栏/菜单的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯开发一个学校一个Android应用程序,并且从除我的应用程序里面有什么IM产品在设备上做任何开到prevent用户,我想这个应用程序,我的意思做的 NOTHING 其他...
所以首先导航栏中应禁用和墙根

Im developing an android application for a school and i want this application when opened to prevent the user from doing anything on the device except what im offering inside my application, and i mean doing NOTHING else... so first the Navigation bar should be disabled and hided

我看到这一点,但其4.4或以上版本,它并不能解决问题,因为如果你轻扫屏幕,你会得到菜单回来。
(<一href=\"http://stackoverflow.com/questions/21724420/how-to-hide-navigation-bar-permanently-in-android-activity\">How要永久隐藏导航栏的android活动?)

i saw this but its for 4.4+ and it doesn't solve the problem because if you swipe the screen you will get the menu back. (How to hide navigation bar permanently in android activity?)

这不也行(<一个href=\"http://stackoverflow.com/questions/16713845/permanently-hide-navigation-bar-on-activity\">Permanently在活动隐藏导航栏)(<一href=\"http://stackoverflow.com/questions/9926767/is-there-a-way-to-hide-the-system-navigation-bar-in-android-ics\">Is有没有办法隐藏的Andr​​oid ICS 系统/导航栏)
我也试图禁止使用的onkeydown导航栏行动,但它并没有在所有的按键工作。

this doesn't work also(Permanently hide navigation bar on activity) (Is there a way to hide the system/navigation bar in Android ICS) i also tried to disable navigation bar actions using onKeyDown but it didn't work on all of the keys.

此外,我要删除的通知栏这使得用户接入设备和其他东西的设置。

in addition i want to remove the notification bar which make the user access the settings of the device and other things..

这不也是工作(<一个href=\"http://stackoverflow.com/questions/19920052/disable-the-notification-panel-from-being-pulled-down\">Disable从在这个环节不解决它提到被拆除)的通知面板,它只是显示隐藏后,它是:•

and this not working also (Disable the notification panel from being pulled down) as mentioned in this link it doesn't solve it, it just hides it after showing it :S

帮助将是AP preciated,

help would be appreciated,

感谢。

推荐答案

要禁用状态NotificationBar:

Its possible

To disable the Status NotificationBar:

您需要放置在通知栏上方的观点,使我们劫持触摸事件的状态通知栏。事不宜迟,这里是code:

You need to place a view on top of the notification bar, so that we hijack the touch events to the Status notification bar. Without further ado, here is the code:

mView= new TextView(this);                                       
mView.setText(".........................................................................");                       

mLP = new WindowManager.LayoutParams(
        WindowManager.LayoutParams.MATCH_PARENT,
        100,
        // Allows the view to be on top of the StatusBar
        WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
        // Keeps the button presses from going to the background window
        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
        // Enables the notification to recieve touch events
        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
        // Draws over status bar
        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
        PixelFormat.TRANSLUCENT);

mLP.gravity =  Gravity.TOP|Gravity.CENTER;      

mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
mWindowManager.addView(mView, mLP);

既然你正在使用的系统覆盖窗口,你所需要的权限:

And since you are using the system overlay window, you need the permission:

<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />

请注意:

不要让你的应用程序全屏,作为上述版本17,支持身临其境的模式,会搞砸了这种方法。

Do not make your app full screen, as the versions above 17, which supports immersive mode, will screw this approach.

这篇关于禁用和永久隐藏的Andr​​oid导航栏/菜单的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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