[英]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.