安卓游戏时禁止状态栏下拉,如何在Android中禁用通知栏下拉菜单?
I am building a new lock screen for Android, but I am unable to lock the notification bar from pulling it down.
I want to disable the notification bar pull-down.
解决方案private void disablePullNotificationTouch() {
WindowManager manager = ((WindowManager) getApplicationContext()
.getSystemService(Context.WINDOW_SERVICE));
WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
// this is to enable the notification to recieve touch events
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
// Draws over status bar
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
localLayoutParams.height = (int) (25 * getResources()
.getDisplayMetrics().scaledDensity);
localLayoutParams.format = PixelFormat.RGBX_8888;
customViewGroup view = new customViewGroup(this);
manager.addView(view, localLayoutParams);
}
//Add this class in your project
public class customViewGroup extends ViewGroup {
public customViewGroup(Context context) {
super(context);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
Log.v("customViewGroup", "**********Intercepted");
return true;
}
}
安卓游戏时禁止状态栏下拉,如何在Android中禁用通知栏下拉菜单?相关推荐
- 安卓游戏时禁止状态栏下拉_Android手机屏蔽状态栏下拉
[声明:]本文是作者(蘑菇v5)原创,版权归作者 蘑菇v5所有,侵权必究.本文首发在简书.如若转发,请注明作者和来源地址!未经授权,严禁私自转载! 一.前言: 如果是系统级应用,也就是手机厂家植入的应 ...
- linux禁止线程网络,linux – 如何在gdb中禁用新线程/线程退出的消息?
我正在调试一个Gtk应用程序,我得到了很多这样的消息: [New Thread 0x7fffde152700 (LWP 11142)] [Thread 0x7fffde152700 (LWP 1114 ...
- android改变下拉框字体颜色,有没有简单的方法来改变Android中的Spinner下拉颜色?...
我创建我的主题以与应用程序一起使用,主题的父级是Theme.AppCompat.Light.NoActionBar 顺便说一句,我想要白色背景和黑色文字. 这是适配器代码 val adapter = ...
- 禁止linux关机,如何在Linux中禁用关机和重新启动命令
shutdown命令调度一个Linux系统关闭电源的时间,它也可以用于在使用特定选项调用时停止,关闭电源或重启机器 ,并重新引导系统重新启动. 默认情况下,某些Linux发行版(如Ubuntu,Lin ...
- 如何在Windows中的命令提示符下删除特定目录中的文件/子文件夹
本文翻译自:How to delete files/subfolders in a specific directory at the command prompt in Windows Say, t ...
- linux在当前目录下创建pic目录,Linux中/proc目录下文件详解
文章转自: Linux中/proc目录下文件详解(一) ------------------------------------------------------------------------ ...
- 【Andrid】去掉android中EditText的下划线
去掉android中EditText的下划线 android:background="@null"
- android 工具栏沉浸 下拉,如何在Android应用中实现一个沉浸式状态栏效果
如何在Android应用中实现一个沉浸式状态栏效果 发布时间:2020-12-08 17:04:42 来源:亿速云 阅读:151 作者:Leah 这篇文章将为大家详细讲解有关如何在Android应用中 ...
- Bootstrap下拉菜单中禁用某个下拉菜单
禁用某个下拉菜单 Bootstrap3中,为下拉菜单中某个下拉项的 <li> 元素添加 .disabled 类,就可以禁止该选项,让该菜单项的链接变灰并失去鼠标悬停效果.如: <ul ...
最新文章
- 通过iTextSharp为PDF添加带有超链接的Bookmark
- 好程序员分享SpringBoot须掌握的注解
- springboot项目中的注解 启动项目的方式 解决spring的bean.xml配置不生效 spring的基础JDBC配置
- python日志统计_python试用-日志统计
- 0.接口测试学习路径
- c语言欺凌,以下哪种行为属于“校园欺凌”?A取绰号B暴力殴打同学C恶意辱骂D企图教唆集体...
- 远离疲倦,告别非理性思维
- 【对话】对话系统经典:检索式对话
- js怎样递归遍历树形菜单数据
- web检查器要不要打开_简单粗暴,详细得不要不要的 JavaWeb快速入门
- 帝国cms生成html网站地图的教程步骤
- 【workqueue】flush_work函数解析
- C语言编程之错误一:error C2059:syntax error : ‘)’
- Java+webdriver的自动化测试框架搭建
- CSS实现div的嵌套居中显示的多种方式
- Python爬取中国大学排名,并且保存到excel中
- 谨慎处理 Service Worker 的更新
- 教你如何做抖音视频广告,助你脱颖而出
- 普通的html页面中ie11的兼容性问题
- Vue源码系列4:模拟实现vue3.x中的计算属性
热门文章
- Spyder has encountered an internal problem!问题解决过程
- 【转】ETL介绍与ETL工具比较
- centos7 yum安装mysql后启动不起来问题
- WebApi系列~HttpClient的性能隐患(转)
- JWT—JSON Web Token - 理解JWT网络间应用用户安全认证交互设计
- daemon进程(转)
- ibatis 3.x 实例
- [Windows Phone] 自己动手实现Telerik公司的LayoutTransform动画效果
- [转载] Python3 如何检查字符串是否是以指定子字符串开头或结尾
- [转载] 学Python的笔记(在网上自学的总结)