title: How to make bottom navigation view stick to a position in android?
body: <p>I tried Bottom Navigation View in android. But it is changing it's position based upon the fragment that i present above it. How to solve this issue ?</p>
  
  <p>activity_main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      tools:context="com.d.wordsearch.MainActivity"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="?attr/colorPrimaryDark"
          android:minHeight="?attr/actionBarSize"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
          app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/&gt;
  
      &lt;FrameLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_weight="10"
          android:id="@+id/fragmentContainer"
          /&gt;
  
      &lt;android.support.design.widget.BottomNavigationView
          xmlns:design="http://schema.android.com/apk/res/android.support.design"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/bottomMenu"
          android:layout_weight="1"
          android:layout_gravity="bottom"
          android:paddingTop="20dp"
          android:layout_alignParentBottom="true"
          app:menu="@menu/my_navigation_items"
          /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>fragment_home.xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:gravity="center"
      android:layout_margin="10dp"
      android:clipToPadding="false"
      tools:context="com.d.wordsearch.HomeFragment"&gt;
  
      &lt;android.support.design.widget.TextInputLayout
          android:id="@+id/input_layout_search"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          &gt;
  
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/search_edit_text"
          android:maxLines="1"
          android:hint="@string/hint_search_field"
          /&gt;
  
      &lt;/android.support.design.widget.TextInputLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          &gt;
  
          &lt;Button
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/word_search_button"
              android:text="@string/button_word_search"
              android:background="@drawable/ripple"
              style="@style/ButtonAppearance"
              android:layout_marginRight="10dp"
              /&gt;
  
          &lt;Button
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/other_search_button"
              android:text="@string/button_other_search"
              android:background="@drawable/ripple"
              style="@style/ButtonAppearance"
              android:layout_marginLeft="10dp"
              /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Just to check if this is happening, I added a few text views into one of the fragments.</p>
  
  <p>fragment_preferences.xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context="com.d.wordsearch.PreferencesFragment"&gt;
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Preferences" /&gt;
  
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Preferences"
          android:layout_marginTop="200dp"
          /&gt;
  
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Preferences" /&gt;
  
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Preferences" /&gt;
  
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Preferences"
          android:layout_marginTop="200dp"
          /&gt;
  
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Preferences"
          android:layout_marginTop="200dp"
          /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And this is what happens when I switch between fragments:</p>
  
  <p><a href="https://i.stack.imgur.com/2aaGA.png" rel="nofollow noreferrer">Home Fragment</a></p>
  
  <p><a href="https://i.stack.imgur.com/sKBEK.png" rel="nofollow noreferrer">Preferences Fragment</a></p>