android屏蔽home键的实现
16lz
2022-01-09
Android中,网上很多屏蔽Home键都智能在4.0以下运行,在4.0以及以上运行直接崩溃。
需要这样更改(来源:http://androidmaster.iteye.com/):
Java代码- @Override
- publicvoidonAttachedToWindow(){
- try{
- intversion=android.os.Build.VERSION.SDK_INT;
- if(version>=15){
- this.getWindow().setFlags(0x80000000,0x80000000);
- }else{
- this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
- }
- super.onAttachedToWindow();
- }catch(Exceptione){
- e.printStackTrace();
- }
- }
转载请注明:http://androidmaster.iteye.com/blog/2037981
更多相关文章
- Your project contains error(s),please fix them before running
- Android开发之fedora13下编译Android源码
- ListItem更改背景色
- <application android:debuggable="false" 有什么用?
- Android测试之ADB部署
- Testing和Instrumentation
- build android for VMware
- android中如何执行java命令
- android 设置应用退出后不在运行列表中显示