Reputation: 190
please help me to set bottom navigation bar position to fixed at bottom, because I'm facing problem while entering inputs in editText fields,bottom navigation bar is moving up and overlaying on other fields
code:
<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>
Upvotes: 2
Views: 16878
Reputation: 1
wrapping the bottom navigation with a linear layout will do the trick. dont forget to fix your LinearLayout at the bottom also.
<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>
Upvotes: 0
Reputation: 1
android:layout_gravity="start"
change it as below:
android:layout_gravity="bottom"
it is not solved by this then the problem lies in other codes. it is unclear that you have told edit text but where it is, there is something mismatch.
Hope, you understand
Upvotes: 0
Reputation: 46
<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>
You can define a linear layout and put your bottom navigation in it with its gravity set to bottom. You can find the other details on: https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html
Upvotes: 2
Reputation: 4643
try including this code in your manifest
<activity android:name=".YourActivity"
android:windowSoftInputMode="adjustNothing">
Upvotes: 7