Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8538847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:13:11+00:00 2026-06-11T11:13:11+00:00

With the help of this tutorial I have created a PagerAdapter for my Android

  • 0

With the help of this tutorial I have created a PagerAdapter for my Android App.

Now I like to add a title to each page (like in the Play Store).
I found this library: http://viewpagerindicator.com/
But I can’t find out how to implement it in my app or how to use it.

Can someone please explain the usage to me?

Here’s the code of my PagerAdapter, if it is needed:

public class MyPagerAdapter extends PagerAdapter {

    public int getCount() {
        return 5;
    }

    public Object instantiateItem(View collection, int position) {

        LayoutInflater inflater = (LayoutInflater) collection.getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        int resId = 0;

        switch(position) {
            case 0:
                resId = R.layout.farleft;
                break;
            case 1:
                resId = R.layout.left;
                break;
            case 2:
                resId = R.layout.middle;
                break;
            case 3:
                resId = R.layout.right;
                break;
            case 4:
                resId = R.layout.farright;
                break;
        }

        View view = inflater.inflate(resId, null);

        ((ViewPager) collection).addView(view, 0);

        return view;
    }

    @Override
    public void destroyItem(View arg0, int arg1, Object arg2) {
        ((ViewPager) arg0).removeView((View) arg2);
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        return arg0 == ((View) arg1);
    }

    @Override
    public Parcelable saveState() {
        return null;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:13:12+00:00Added an answer on June 11, 2026 at 11:13 am

    Now I like to add a title to each page (like in the Play Store)

    PagerTabStrip and PagerTitleStrip are in the Android Support package, where you got ViewPager from. Simply add one of those as a child of your ViewPager, with android:layout_gravity indicating whether you want the strip on the top or bottom. Then, as Luksprog indicated, add getPageTitle() to your PagerAdapter.

    Here is a sample project demonstrating the use of PagerTabStrip.

    But I can’t find out how to implement it in my app or how to use it.

    Basic instructions are on the page that you linked to. Add one of the ViewPagerIndicator widgets to your layout, positioned where you want it (e.g., use a vertical LinearLayout to stack one above your ViewPager). Sometime after you call setAdapter() on the ViewPager, call setViewPager() on the indicator widget, supplying it your ViewPager. Once again, you will also need to implement getPageTitle() on your PagerAdapter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android app which includes an activity called Help This uses a
I have created a photo gallery with the help of tutorial http://developer.android.com/resources/tutorials/views/hello-gallery.html but now
I have scoured Google for a tutorial to help with this but haven't been
I created an ExpandableListView with the help of this tutorial: link . I understand
I have created an application in Android for RabbitMQ using RabbitMQ-Android tutorial. It is
I have been following this tutorial for setting up tabs in your application. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
I am following this tutorial to create a static library. I have: Created the
I have this Drag Drop UI, here , created from this tutorial http://net.tutsplus.com/tutorials/javascript-ajax/inettuts/ I
Please help this beginner here... I have a SQL Server 2008 R2 running on
I am trying to learn Django (and Python) and have created my own app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.