How to use viewpagerindicator with ViewPager in Android?

11,599

Solution 1

You could use the new android PagerTabStrip, it works very nice and is backwards compatible. Here is a nice example project, using the android PagerTabStrip:

http://code.google.com/p/viewpage-title-project/

http://developer.android.com/reference/android/support/v4/view/PagerTabStrip.html

The only thing you need to do is importing the android support library version 9:

Right click your project --> android tools --> add support library.

Solution 2

  1. Download the source code of that project
  2. In your Eclipse workspace: File > New > Project... > Android > Android project from existing code
  3. As the location choose viewpagerindicator/library (this should create the library project in your workspace)
  4. Right click on your project > Properties...
  5. Android > Library > Add...
  6. Select the viewpagerindicator project you have created with previous steps.
  7. Follow the instructions about how to include a view pager indicator in your layouts as on http://viewpagerindicator.com/#usage
Share:
11,599
Jainendra
Author by

Jainendra

Send me a direct message

Updated on July 21, 2022

Comments

  • Jainendra
    Jainendra almost 2 years

    I want to use viewpagerindicator with ViewPager in my android application. I've created ViewPager, now I want to display the title of each page in the ViewPager. After reading this I came to know that viewpagerindicator will be helpful. Now the problem is that how can I use this project in my project. I tried adding from properties --> java build path --> Libraries --> add external class folders but it doesn't helped.
    I also tried to compile the libraries downloaded from http://viewpagerindicator.com/, but that gives me a bunch of The method setViewPager(ViewPager) of type LinePageIndicator must override a superclass method type errors.

    I want to use TabPageIndicator and TitlePageIndicator from viewpagerindicator project in my application as described here.

  • Jainendra
    Jainendra over 11 years
    I tried this but this gives me a bunch of the method setViewPager(ViewPager) of type LinePageIndicator must override a superclass method type errors in the library project.
  • Vincent Mimoun-Prat
    Vincent Mimoun-Prat over 11 years