Android 如何让BottomNavigationView即使在打开键盘时也保持向下?
我有一个editText视图、一个RecyclerView和一个底部导航视图。 当我提示编辑文本时,键盘打开,循环视图被填充。但是BottomNavigationview仍然位于现在打开的键盘的顶部,而我的Recyclerview位于bottomnavigation视图的顶部。现在,当键盘打开时,recyclerview和edittext正在叠加。是否有任何方法可以限制bottomnavigationview在键盘打开时消失 这是我的xml文件:Android 如何让BottomNavigationView即使在打开键盘时也保持向下?,android,xml,bottomnavigationview,Android,Xml,Bottomnavigationview,我有一个editText视图、一个RecyclerView和一个底部导航视图。 当我提示编辑文本时,键盘打开,循环视图被填充。但是BottomNavigationview仍然位于现在打开的键盘的顶部,而我的Recyclerview位于bottomnavigation视图的顶部。现在,当键盘打开时,recyclerview和edittext正在叠加。是否有任何方法可以限制bottomnavigationview在键盘打开时消失 这是我的xml文件: <?xml version="1.0" e
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Abfahrtsmonitor">
<EditText
android:id="@+id/editText"
android:layout_width="360dp"
android:layout_height="47dp"
android:ems="10"
android:hint="Suche"
android:inputType="textPersonName"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="7dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/Recycleview"
android:layout_width="370dp"
android:layout_height="441dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="4dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toTopOf="@+id/navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<android.support.design.widget.BottomNavigationView
android:layout_width="368dp"
android:layout_height="48dp"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="511dp"
android:id="@+id/navigation"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation"/>
现在看起来是这样的:在清单中定义的活动标记中执行以下操作
<activity
android:name=".YourActivity"
android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"/>
在AndroidManifest.xml中,将以下android:WindowsOfInputMode=adjustPan添加到包含BottomNavigationView的活动中
这个解决方案在我的情况下是有效的。从清单中删除android:windowSoftInputMode,或者您可以将其设置为stateAllwayshidden | adjustNothing。使用android:windowSoftInputMode=adjustNothing | stateHiddenThank,它可以工作欢迎您将其作为答案发布,以便帮助其他可能的副本
<application
android:name=".ExampleApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"/>
</application>