I create an app which need to disa开发者_StackOverflow中文版ble all buttons to allow user to leave the application - back button, menu button, camera button, call button, etc, and app should have 1 button for exit. I don't know how to disable all buttons. Tell me please, thank you
The Physical buttons? No, you can't disable all of them. Home button needs to work... Android - Is It possible to disable the click of home button
Related: Android: mass enable/disable buttons
Try this: 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);
精彩评论