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