【问题标题】:How to hide bottom navigation bar when keyboard is open in android app development?在android应用程序开发中打开键盘时如何隐藏底部导航栏?
【发布时间】:2019-03-10 12:25:03
【问题描述】:

我正在创建 android 应用程序,其中有底部导航栏,如 youtube 和其他社交媒体。我的应用程序中有一个文本框,所以当我在文本框上键入时,键盘是打开的,底部导航栏位于我的键盘上。那么当我开始输入时如何隐藏底部导航栏。

应用的父布局是Linearlayout。

而adjustPan 将不起作用。

【问题讨论】:

标签: android android-studio android-linearlayout android-bottom-nav-view


【解决方案1】:

你可以这样做

View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
              | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);

参考:https://developer.android.com/training/system-ui/navigation

【讨论】:

  • 您在这里谈论的是“返回”、“主页”和“最近”按钮。问题是关于 BottomNavigationBar
猜你喜欢
  • 2017-08-24
  • 1970-01-01
  • 2023-04-01
  • 1970-01-01
  • 2016-01-29
  • 1970-01-01
  • 1970-01-01
  • 2019-02-21
  • 1970-01-01
相关资源
最近更新 更多