Android中,网上很多屏蔽Home键都智能在4.0以下运行,在4.0以及以上运行直接崩溃。

需要这样更改(来源:http://androidmaster.iteye.com/):

Java代码
  1. @Override
  2. publicvoidonAttachedToWindow(){
  3. try{
  4. intversion=android.os.Build.VERSION.SDK_INT;
  5. if(version>=15){
  6. this.getWindow().setFlags(0x80000000,0x80000000);
  7. }else{
  8. this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
  9. }
  10. super.onAttachedToWindow();
  11. }catch(Exceptione){
  12. e.printStackTrace();
  13. }
  14. }

转载请注明:http://androidmaster.iteye.com/blog/2037981

更多相关文章

  1. Your project contains error(s),please fix them before running
  2. Android开发之fedora13下编译Android源码
  3. ListItem更改背景色
  4. <application android:debuggable="false" 有什么用?
  5. Android测试之ADB部署
  6. Testing和Instrumentation
  7. build android for VMware
  8. android中如何执行java命令
  9. android 设置应用退出后不在运行列表中显示

随机推荐

  1. Android(安卓)Activity和Intent机制 学习
  2. Android(安卓)studio Failure [INSTALL_F
  3. Android应用程序启动过程源代码分析
  4. 最新历史版本 :Android修改system只读权
  5. Android(安卓)告急!
  6. Android(安卓)TouchEvent事件传递机制初
  7. Android系统自带Spinner+Adapter基础
  8. android的PowerManager和PowerManager.Wa
  9. TextView属性详解
  10. android:imeOptions属性