5

图片

我的 BottomNavigationView 工作正常,但是当我按下它在上面写字时它会上升EditText。上面的链接上有一张图片。

这是我包含在内的清单,android:windowSoftInputMode="adjustPan"但它对我不起作用。还有其他建议吗?

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity"
        android:windowSoftInputMode="adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

我的 xml 文件:

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:design="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.segunfamisa.sample.bottomnav.MainActivity">

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:id="@+id/mainToolbar"
        android:background="#ffffff"
        android:titleTextColor="#ffffff">
    </android.support.v7.widget.Toolbar>

    <View
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@drawable/shadow_top"/>

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#ffffff">

    </FrameLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="@drawable/shadow"/>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        design:menu="@menu/bottom_nav_items"
        design:itemIconTint="@drawable/selector"
        design:itemTextColor="@drawable/selector"
        android:background="#000000" />
</LinearLayout>
4

2 回答 2

16

在您AndroidManifest.xml将以下内容添加android:windowSoftInputMode="adjustPan"到您的活动中BottomNavigationView

于 2017-05-29T10:19:04.250 回答
1

您只需像这样在清单中添加此代码..

 <activity android:name=".MainActivity"
        android:windowSoftInputMode="adjustPan">

这对我有用..快乐编码

于 2018-12-05T12:56:26.667 回答