简体   繁体   English

键盘出现时BottomNavigationBar消失

[英]BottomNavigationBar disappears when keyboard appears

in my application I have created a custom bottomNavigationView with a LinearLayout. 在我的应用程序中,我使用LinearLayout创建了一个自定义的bottomNavigationView。

But I've got a problem, when the virtual keyboard appears my custom navigationView not disappears but instead it becomes smaller and moves to my keyboard. 但是我有一个问题,当虚拟键盘出现时,我的自定义NavigationView不会消失,而是会变小并移至我的键盘上。

So can I make it disappear when the keyboard appears? 那么当键盘出现时我可以使其消失吗? Or somehow can I set the layout like a fixed element ? 还是以某种方式可以将布局设置为固定元素?

This is the layout I'm using 这是我正在使用的布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="it.peoople.main.MainActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="20"
    android:orientation="vertical"
    >

    <FrameLayout
        android:id="@+id/head_layout"
        android:layout_width="match_parent"
        android:minHeight="52dp"
        android:layout_height="wrap_content"
        >
    </FrameLayout>

    <FrameLayout
        android:id="@+id/center_layout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="15"
        >
    </FrameLayout>


</LinearLayout>

<!-- menu -->
<LinearLayout
    android:layout_weight="1.5"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:orientation="horizontal"
    android:layout_marginTop="4dp"
    android:layout_marginBottom="4dp"
    >

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item1"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item2"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item3"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item4"
        />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/item5"
        />

</LinearLayout>

Thank you for your attention. 感谢您的关注。

You still want the soft keyboard to show correct? 您仍然希望软键盘显示正确吗? This will help if want your bottom navigation bar to stay at the bottom and be covered until the soft keyboard hides again. 如果希望您的底部导航栏停留在底部并被遮盖直到再次隐藏软键盘,这将有所帮助。

In your manifest, put this in the activity that you use the keyboard. 在清单中,将其放入使用键盘的活动中。 Like so: 像这样:

    <activity
        android:name=".YourActivityName"
        //ADD THIS LINE 
        android:windowSoftInputMode="stateHidden|adjustPan" >
    </activity>`here

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

相关问题 在软键盘出现时出现状态栏但在沉浸模式下软键盘消失时不会隐藏 - Status Bar appears when soft keyboard appears but not hidden back when soft keyboard disappears while in Immersive Mode 单击搜索输入时,Android 键盘出现和消失 - Android keyboard appears and disappears when clicking search input 当软键盘出现或消失时,Recyclerview 向下滚动 - Recyclerview scrolls down when soft keyboard appears or disappears 如何检测android键盘何时出现/消失? (5.02) - How can I detect when android keyboard appears/disappears? (5.02) Android:屏幕键盘出现和消失时,是否有自动调用的监听器? - Android: When the on-screen keyboard appears and disappears, are there any listeners that are automatically called? android Edit Text键盘出现,并在可扩展列表中突然消失 - android Edit Text keyboard appears and suddenly disappears in expandable list 当我单击编辑它时,我的文本字段隐藏在 BottomNavigationBar 的键盘后面 - My textfield hides behind keyboard in BottomNavigationBar when I click to edit it 键盘出现时ActionBar隐藏 - ActionBar is hiding when keyboard appears 出现键盘时显示滚动条 - Display Scrollbar when keyboard appears 出现键盘时布局更改 - Layout changes when keyboard appears
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM