Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An interactive indicator to navigate between the different pages of a ViewPager
Java Groovy
branch: master

This branch is 1 commit ahead, 6 commits behind astuetz:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
library
sample
.gitignore
README.md
build.gradle
pom.xml
settings.gradle

README.md

Android PagerSlidingTabStrip

Interactive paging indicator widget, compatible with the ViewPager from the Android Support Library.

Try out the sample application on the Play Store.

PagerSlidingTabStrip Sample Screenshot 1 PagerSlidingTabStrip Sample Screenshot 2

Usage

For a working implementation of this project see the sample/ folder.

  1. Include the PagerSlidingTabStrip widget in your view. This should usually be placed adjacent to the ViewPager it represents.

    <com.astuetz.viewpager.extensions.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dip" />
    
  2. In your onCreate method (or onCreateView for a fragment), bind the widget to the ViewPager.

     // Set the pager with an adapter
     ViewPager pager = (ViewPager) findViewById(R.id.pager);
     pager.setAdapter(new TestAdapter(getSupportFragmentManager()));
    
     // Bind the widget to the adapter
     PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
     tabs.setViewPager(pager);
    
  3. (Optional) If you use an OnPageChangeListener with your view pager you should set it in the widget rather than on the pager directly.

     // continued from above
     tabs.setOnPageChangeListener(mPageChangeListener);
    

Developed By

Credits

License

Copyright 2013 Andreas Stuetz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Something went wrong with that request. Please try again.