如何将底部导航栏位置固定在 android
how to set bottom navigation bar position fixed in android
请帮我将底部导航栏位置设置为固定在底部,
因为我在 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>
尝试在您的清单中包含此代码
<activity android:name=".YourActivity"
android:windowSoftInputMode="adjustNothing">
<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
android:layout_gravity="start"
修改如下:
android:layout_gravity="bottom"
这样解决不了,问题出在其他代码上。目前尚不清楚您是否已告知编辑文本,但它在哪里,有些不匹配。
希望,你明白
用线性布局包裹底部导航就可以了。也不要忘记在底部修复您的 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>
请帮我将底部导航栏位置设置为固定在底部, 因为我在 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>
尝试在您的清单中包含此代码
<activity android:name=".YourActivity"
android:windowSoftInputMode="adjustNothing">
<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
android:layout_gravity="start"
修改如下:
android:layout_gravity="bottom"
这样解决不了,问题出在其他代码上。目前尚不清楚您是否已告知编辑文本,但它在哪里,有些不匹配。
希望,你明白
用线性布局包裹底部导航就可以了。也不要忘记在底部修复您的 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>