SmartTabLayout
A custom ViewPager title strip which gives continuous feedback to the user when scrolling.
This library has been added some features and utilities based on android-SlidingTabBasic project of Google Samples.
Live Demo
https://play.google.com/store/apps/details?id=com.ogaclejapan.smarttablayout.demo
Usage
(For a working implementation of this project see the demo/ folder.)
Add the dependency to your build.gradle.
dependencies {
compile 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
//Optional: see how to use the utility.
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1@aar'
//Optional: see how to use the utility.
compile 'com.ogaclejapan.smarttablayout:utils-v13:1.6.1@aar'
}
Include the SmartTabLayout widget in your layout.
This should usually be placed above the ViewPager it represents.
In your onCreate method (or onCreateView for a fragment), bind the widget to the ViewPager.
(If you use a utility together, you can easily add items to PagerAdapter)
e.g. ViewPager of v4.Fragment
(Optional) If you use an OnPageChangeListener with your view pager you should set it in the widget rather than on the pager directly.
(Optional) Using the FragmentPagerItemAdapter of utility, you will be able to get a position in the Fragment side.
This position will help to implement the parallax scrolling header that contains the ViewPager :P