【发布时间】:2017-03-08 15:10:32
【问题描述】:
我的 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>
【问题讨论】:
-
您需要使用CoordinatorLayout
-
找到解决方案了吗?
-
我在 windowSoftInputMode (manifest) 上使用了调整大小,还添加了 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);在我的 MainActivity @FelipeA 上。
-
@MatiasNagore,我做了同样的事情,而且工作得像个魅力!
标签: android bottomnavigationview