title: Android Support Design: BottomNavigationView
body: <p>I am trying to achieve something like this <a href="https://material.google.com/components/bottom-navigation.html#bottom-navigation-behavior" rel="noreferrer">https://material.google.com/components/bottom-navigation.html#bottom-navigation-behavior</a></p>
  
  <p>But recycler view is hiding below toolbar and no effect is on BottomNavigationView</p>
  
  <p>Below is my code</p>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout 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:id="@+id/activity_main"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context=".MainActivity"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:id="@+id/app_bar_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="?attr/colorPrimary"
              app:layout_scrollFlags="scroll|enterAlways"
              app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /&gt;
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
  
          &lt;android.support.design.widget.BottomNavigationView
              android:id="@+id/nm_bottom"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:background="@color/colorPrimaryDark"
              android:foregroundTint="@color/colorAccent"
              app:itemIconTint="@android:color/white"
              app:itemTextColor="@android:color/white"
              app:menu="@menu/nav_menu" /&gt;
  
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/rv"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_above="@id/nm_bottom"
              app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
      &lt;/RelativeLayout&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>item.xml</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:padding="4dp"&gt;
  
      &lt;android.support.v7.widget.CardView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:cardElevation="2dp"&gt;
  
          &lt;RelativeLayout
              android:layout_width="fill_parent"
              android:layout_height="?android:attr/listPreferredItemHeight"
              android:padding="4dp"&gt;
  
              &lt;ImageView
                  android:id="@+id/icon"
                  android:layout_width="wrap_content"
                  android:layout_height="fill_parent"
                  android:layout_alignParentBottom="true"
                  android:layout_alignParentTop="true"
                  android:layout_marginRight="6dip"
                  android:contentDescription="TODO"
                  android:src="@drawable/ic_storage" /&gt;
  
              &lt;TextView
                  android:id="@+id/secondLine"
                  android:layout_width="fill_parent"
                  android:layout_height="26dip"
                  android:layout_alignParentBottom="true"
                  android:layout_alignParentRight="true"
                  android:layout_toRightOf="@id/icon"
                  android:ellipsize="marquee"
                  android:text="Description"
                  android:textSize="12sp" /&gt;
  
              &lt;TextView
                  android:id="@+id/firstLine"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_above="@id/secondLine"
                  android:layout_alignParentRight="true"
                  android:layout_alignParentTop="true"
                  android:layout_alignWithParentIfMissing="true"
                  android:layout_toRightOf="@id/icon"
                  android:gravity="center_vertical"
                  android:text="Example application"
                  android:textSize="16sp" /&gt;
  
          &lt;/RelativeLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  &lt;/FrameLayout&gt;
  
  
  
  
  public class MainActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener {
  
              private static final Logger logger = Logger.getLogger(MainActivity.class.getSimpleName());
  
              private BottomNavigationView navigationView;
              private RecyclerView mRecyclerView;
              private MyAdapter mAdapter;
  
              @Override
              protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_main);
                  initViews();
              }
  
              private void initViews() {
                  navigationView = (BottomNavigationView) findViewById(R.id.nm_bottom);
                  navigationView.setOnNavigationItemSelectedListener(this);
                  mRecyclerView = (RecyclerView) findViewById(R.id.rv);
  
                  // use this setting to improve performance if you know that changes
                  // in content do not change the layout size of the RecyclerView
                  mRecyclerView.setHasFixedSize(true);
  
                  // use a linear layout manager
                  LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
                  mRecyclerView.setLayoutManager(mLayoutManager);
  
                  // specify an adapter (see also next example)
                  List&lt;String&gt; myDataset = new ArrayList&lt;&gt;();
                  for (int i = 0; i &lt; 100; i++) {
                      myDataset.add("Index #" + i);
                  }
                  mAdapter = new MyAdapter(myDataset);
                  mRecyclerView.setAdapter(mAdapter);
              }
  
              @Override
              public boolean onNavigationItemSelected(@NonNull MenuItem item) {
  
                  return false;
              }
          }
  
          public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt; {
              private List&lt;String&gt; mDataset;
  
              // Provide a reference to the views for each data item
              // Complex data items may need more than one view per item, and
              // you provide access to all the views for a data item in a view holder
              public class ViewHolder extends RecyclerView.ViewHolder {
                  // each data item is just a string in this case
                  public TextView txtHeader;
                  public TextView txtFooter;
  
                  public ViewHolder(View v) {
                      super(v);
                      txtHeader = (TextView) v.findViewById(R.id.firstLine);
                      txtFooter = (TextView) v.findViewById(R.id.secondLine);
                  }
              }
  
              public void add(int position, String item) {
                  mDataset.add(position, item);
                  notifyItemInserted(position);
              }
  
              public void remove(String item) {
                  int position = mDataset.indexOf(item);
                  mDataset.remove(position);
                  notifyItemRemoved(position);
              }
  
              // Provide a suitable constructor (depends on the kind of dataset)
              public MyAdapter(List&lt;String&gt; myDataset) {
                  mDataset = myDataset;
              }
  
              // Create new views (invoked by the layout manager)
              @Override
              public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                             int viewType) {
                  // create a new view
                  View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recycler_view, parent, false);
                  // set the view's size, margins, paddings and layout parameters
                  ViewHolder vh = new ViewHolder(v);
                  return vh;
              }
  
              // Replace the contents of a view (invoked by the layout manager)
              @Override
              public void onBindViewHolder(ViewHolder holder, int position) {
                  // - get element from your dataset at this position
                  // - replace the contents of the view with that element
                  final String name = mDataset.get(position);
                  holder.txtHeader.setText(mDataset.get(position));
                  holder.txtHeader.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          remove(name);
                      }
                  });
  
                  holder.txtFooter.setText("Footer: " + mDataset.get(position));
  
              }
  
              // Return the size of your dataset (invoked by the layout manager)
              @Override
              public int getItemCount() {
                  return mDataset.size();
              }
  
          }
  </code></pre>