本文整理汇总了Java中com.viewpagerindicator.CirclePageIndicator.setCurrentItem方法的典型用法代码示例。如果您正苦于以下问题:Java CirclePageIndicator.setCurrentItem方法的具体用法?Java CirclePageIndicator.setCurrentItem怎么用?Java CirclePageIndicator.setCurrentItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.viewpagerindicator.CirclePageIndicator
的用法示例。
在下文中一共展示了CirclePageIndicator.setCurrentItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.viewpagerindicator.CirclePageIndicator; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_circles);
mAdapter = new CircleAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
mIndicator.setCurrentItem(mAdapter.getCount() - 1);
//You can also do: indicator.setViewPager(pager, initialPage);
}
示例2: onCreate
import com.viewpagerindicator.CirclePageIndicator; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_circles);
mAdapter = new TestFragmentAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
mIndicator.setCurrentItem(mAdapter.getCount() - 1);
//You can also do: indicator.setViewPager(pager, initialPage);
}
示例3: onCreate
import com.viewpagerindicator.CirclePageIndicator; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome_viewpager_layout);
titleIndicator = (CirclePageIndicator)findViewById(R.id.indicator);
// Instantiate a ViewPager and a PagerAdapter.
mPager = (ViewPager) findViewById(R.id.welcome_viewpager_layout);
mPagerAdapter = new WelcomePagerAdapter2(getFragmentManager()) {};
mPager.setAdapter(mPagerAdapter);
titleIndicator.setViewPager(mPager);
titleIndicator.setCurrentItem(mPagerAdapter.getCount()-1);
titleIndicator.setCurrentItem(0);
mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
titleIndicator.setCurrentItem(position);
// When changing pages, reset the action bar actions since they are dependent
// on which page is currently active. An alternative approach is to have each
// fragment expose actions itself (rather than the activity exposing actions),
// but for simplicity, the activity provides the actions in this sample.
invalidateOptionsMenu();
}
});
}