Android view pager with page indicator

后端 未结 7 1524
终归单人心
终归单人心 2020-12-07 19:23

I need to get page indicator in the view pager file with images. Here is my code.

public class IndicatorActivity extends Activity {


 /** Called when the ac         


        
7条回答
  •  情深已故
    2020-12-07 19:55

    Here are a few things you need to do:

    1-Download the library if you haven't already done that.

    2- Import into Eclipse.

    3- Set you project to use the library: Project-> Properties -> Android -> Scroll down to Library section, click Add... and select viewpagerindicator.

    4- Now you should be able to import com.viewpagerindicator.TitlePageIndicator.

    Now about implementing this without using fragments:

    In the sample that comes with viewpagerindicatior, you can see that the library is being used with a ViewPager which has a FragmentPagerAdapter.

    But in fact the library itself is Fragment independant. It just needs a ViewPager. So just use a PagerAdapter instead of a FragmentPagerAdapter and you're good to go.

提交回复
热议问题