TitlePageIndicator CirclePageIndicator both on same ViewPager

蓝咒 提交于 2019-12-22 18:14:03

问题


I'm developing an Android 3.1 tablet application.

I'm using a ViewPager with Fragments and also I'm using ViewPageIndicator to show a TitlePageIndicator and a CirclePageIndicator.

My problem is that I can use both together.

public class FillEReportFragmentActivity extends FragmentActivity
{
    private ViewPager mViewPager;
    private FillEReportFragmentPagerAdapter mPagerAdapter;

    @Override
    protected void onCreate(Bundle savedInstance)
    {
        super.onCreate(savedInstance);
        setContentView(R.layout.fill_ereport_paged);

        mViewPager = (ViewPager)findViewById(R.id.pager);
        mPagerAdapter = new FillEReportFragmentPagerAdapter(getSupportFragmentManager());
        mViewPager.setAdapter(mPagerAdapter);

        CirclePageIndicator mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
        mIndicator.setViewPager(mViewPager);
        //mIndicator.setSnap(true);
        //mIndicator.setCurrentItem(0);

        //Bind the title indicator to the adapter
        TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles);
        titleIndicator.setViewPager(mViewPager);
    }
}

It only works the last one which is bound to mViewPager.

How can I bind TitleIndicator and CirclePageIndicator with the same ViewPager?

来源:https://stackoverflow.com/questions/11132741/titlepageindicator-circlepageindicator-both-on-same-viewpager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!