简体   繁体   English

android应用程序中的底部导航栏

[英]bottom navigation bar in android application

I develop an android application and I need to prevent the user to close the application from navigation bar buttons .. there is another way to close the application. 我开发了一个android应用程序,我需要防止用户从导航栏按钮关闭该应用程序。还有另一种方法来关闭该应用程序。 I search a lot and didn't find any way to Permanently hide bottom navigation bar or at least stop all button control 我搜索了很多东西,却没有找到永久隐藏底部导航栏或至少停止所有按钮控制的方法

If you meant to disable the back button on device, you could override 如果您要禁用设备上的后退按钮,则可以覆盖

@Override
public void onBackPressed() {
    super.onBackPressed(); //delete or comment this line
    .......//do something you want
}

Use this method to disable the Home button 使用此方法禁用主页按钮

@Override
public void onAttachedToWindow() {
    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
    super.onAttachedToWindow();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM