如何在android中设置底部导航栏位置

问题描述 投票:0回答:4

请帮我设置底部导航栏位置固定在底部,因为我在editText字段输入输入时遇到问题,底部导航栏向上移动并覆盖在其他字段上

码:

<RelativeLayout 
 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">

<!---     -->
 <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:background="#FF6936C3"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_gravity="start"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"
        app:menu="@menu/bottom_nav_items" /> 
</RelativeLayout>
android android-layout material-design bottomnavigationview
4个回答
2
投票
<LinearLayout>
  <android.support.design.widget.BottomNavigationView
   android:id="@+id/navigation"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_gravity="bottom"
   android:background="?android:attr/windowBackground"
   app:menu="@menu/navigation" />
</LinearLayout>

您可以定义线性布局,并将其底部导航设置在其中,并将其重力设置为底部。您可以在以下位置找到其他详细信息:https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html


2
投票

尝试在清单中包含此代码

  <activity android:name=".YourActivity" 
      android:windowSoftInputMode="adjustNothing">

0
投票
android:layout_gravity="start"

改变如下:

android:layout_gravity="bottom"

它没有解决,那么问题在于其他代码。目前还不清楚你是否已经告诉编辑文本,但它在哪里,有一些不匹配的东西。

希望你能理解


0
投票

用线性布局包装底部导航就可以了。别忘了在底部修复你的LinearLayout。

    <LinearLayout
            android:id="@+id/linearLayout4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="bottom"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent">
    <android.support.design.widget.BottomNavigationView
       android:id="@+id/navigation"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_gravity="bottom"
       android:background="?android:attr/windowBackground"
       app:menu="@menu/navigation" />
</LinearLayout>
© www.soinside.com 2019 - 2024. All rights reserved.