开发者

How to shield the home key if my app is active? (Screensaver, Lockscreen)

If I want to write 开发者_如何学Pythona 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);


Taking over the home key is an Android no-no.

The only screensaver in Android should be the screen going off. Why would anyone want to run down their battery instead of just pressing one button to turn the screen off and doing the same to turn it back on? It just doesn't make sense on a device with a very limited power supply to run a screensaver.

I'm not quite sure but from what I have read online, custom lock screens can only be done in custom firmware or rooted applications.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜