我正在使用CirclePageIndicator来创建我的应用程序。它有三种布局左,中,右布局。当应用程序启动时,它会转到左侧布局。我希望它处于中间布局。有什么帮助吗? 我的代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
ViewPager mPager = (ViewPager) findViewById(R.id.viewpager);
PagerAdapter adapter = new CircularPagerAdapter();
mPager.setAdapter(adapter);
mPager.setCurrentItem(1);
CirclePageIndicator circleIndicator = (CirclePageIndicator) findViewById(R.id.indicator);
circleIndicator.setViewPager(mPager);
final float density = getResources().getDisplayMetrics().density;
circleIndicator.setFillColor(0xFFFFFFFF);
circleIndicator.setStrokeColor(0xFFFFFFFF);
circleIndicator.setStrokeWidth(1);
circleIndicator.setRadius(6 * density);
}
答案 0 :(得分:0)
我认为你使用ViewPager
来控制你的布局。使用
myViewPager.setCurrentItem(1);
指标与此无关。