Thursday 17 December 2015

How to hide/show Toolbar when list is scrolling?

demo_gif 



 This tutorial describes how to show effect when list is scrolling up and down. Hiding Toolbar and any other views when list is scrolling down and showing it again when it’s scrolling up. In this tutorial we are using RecyclerView and Tollbar to achieve this effect as we see in Google play. We will add list header on top of the list. To complete this task follow below points. 1) - First of all we will create a new project in Android studio and add some necessary libraries.
  1. compile "com.android.support:recyclerview-v7:21.0.0"
  2. compile 'com.android.support:cardview-v7:21.0.3'
2)- We will define styles.xml so that our app can use Material Theme .
  1. <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  2. <item name="colorPrimary">@color/colorPrimary</item>
  3. <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
  4. </style>
3)- Next create a activity_main.xml for our MainActivity class.
  1. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:layout_width="match_parent"
  3. android:layout_height="match_parent">
  4. ....
 
Read full blog at our highly specific C, Java, PHP, Javascript, iPhone, android developer forum about the topic described above How to hide/show Toolbar when list is scrolling?. You can also learn much more about different programming technologies and can enhance your tech skills.

No comments:

Post a Comment