Android disable all hardware keys for lockscreen app

≯℡__Kan透↙ 提交于 2019-12-13 18:30:28

问题


I am coding a custom lockscreen app for android.

I have managed to disable the back button. But the home button and the recent apps button on ICS proved not to be as easy.

I searched around and came up with:

@Override
public void onAttachedToWindow() {
    // TODO Auto-generated method stub
    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
    super.onAttachedToWindow();
}

However, this throws IllegalArgumentException window type can not be changed after it is added. I then tried to set it in onCreate() but the home key still functions.

I am willing to use root methods to achieve this. Is there any way to get it done?

Any help would be appreciated!


回答1:


For android versions above 2.3, overriding of the Home button is disabled



来源:https://stackoverflow.com/questions/12683418/android-disable-all-hardware-keys-for-lockscreen-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!