當前位置: 首頁>>代碼示例>>Java>>正文


Java CirclePageIndicator.setCurrentItem方法代碼示例

本文整理匯總了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);
}
 
開發者ID:xulailing,項目名稱:android-open-project-demo-master,代碼行數:17,代碼來源:SampleCirclesInitialPage.java

示例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);
}
 
開發者ID:xulailing,項目名稱:android-open-project-demo-master,代碼行數:17,代碼來源:SampleCirclesInitialPage.java

示例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();
        }
    });
}
 
開發者ID:JMtorii,項目名稱:StraightComfort-Android,代碼行數:26,代碼來源:WelcomePagerAdapter.java


注:本文中的com.viewpagerindicator.CirclePageIndicator.setCurrentItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。