In the below example I have created Collapsing Toolbar function. Here I have created CoordinatorLayout and created all layout in CoordinatorLayout. Now I have added AppBarLayout, CollapsingToolbarLayout, ImageView, Toolbar, RecyclerView and FloatingActionButton. Now I have created CardView.xml layout here I have added CardView. Next step I have created CardAdapter class for using recyclerview & cardview. In cardAdapter I have also used Toast function to get item Position. In next step I have created Collepse class for set recycler view item name and id. In MainActivity I have used setOnClickListener for floatingActionButton. You can see below program it will clearly describe How to create CollapsingToolbar function.