`
carywei
  • 浏览: 191366 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

待研究中----

 
阅读更多

 

 requestWindowFeature(Window.FEATURE_NO_TITLE);取消标题。

private KeyguardManager.KeyguardLock mKeyguardLock;

       Window winP = getWindow();
        winP.addFlags(WindowManager.LayoutParams.FLAG_KEYEVENT_PASS_TO_USER);
        winP.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);

        //winP.setLayout(WindowManager.LayoutParams.FILL_PARENT,
        //               WindowManager.LayoutParams.FILL_PARENT);
        //winP.setGravity(Gravity.CENTER);

        setContentView(R.layout.chargepoweroff);
        mImageView = (View) findViewById(R.id.charge);
        mImageView.setBackgroundResource(R.drawable.test_battery_charge);
        KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
        mKeyguardLock = km.newKeyguardLock(TAG);

开始的时候屏蔽键盘。
onStart    disableKeyguard(false);和   onStop调用这个方法。 disableKeyguard(false);

private void disableKeyguard(boolean disable) {
        if (disable) {
            mKeyguardLock.disableKeyguard();
        } else {
            mKeyguardLock.reenableKeyguard();
        }

    }

 

filter.addAction(Intent.ACTION_BATTERY_CHANGED);
        filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
        filter.addAction(Intent.ACTION_SCREEN_OFF);
        filter.addAction(Intent.ACTION_SCREEN_ON);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics