如何屏蔽home键,如果我的应用程序被激活? (屏幕,锁屏) [英] How to shield the home key if my app is active? (Screensaver, Lockscreen)
本文介绍了如何屏蔽home键,如果我的应用程序被激活? (屏幕,锁屏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我想要写一个屏幕保护程序或锁屏。有没有一种方法,以prevent从回到发射?
If I want to write a Screensaver or Lockscreen. Is there a way to prevent the home key from going back to the launcher?
推荐答案
简单:当你进入活动,通话
Simple: when you enter the activity, call
getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
和当您退出活动,请拨打
and when you exit the activity, call
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION);
这篇关于如何屏蔽home键,如果我的应用程序被激活? (屏幕,锁屏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文