2013-08-30 16 views
0

我有一個用作ViewPager適配器的sectionsPagerAdapter。使用SectionsPagerAdapter android

mSectionsPagerAdapter = new SectionsPagerAdapter(
      getSupportFragmentManager()); 

    // Set up the ViewPager with the sections adapter. 
    mViewPager = (ViewPager) findViewById(R.id.pager); 
    mViewPager.setAdapter(mSectionsPagerAdapter); 

我有3個片段,我想在單擊按鈕時在兩個片段之間切換?

回答

6

我猜測你的SectionsPagerAdapter是在你使用ADT創建一個新的活動時自動生成的,並且指定了一個帶有標籤的導航類型。如果是這種情況,那麼您的SectionsPagerAdapter將擴展FragmentPagerAdapter,whose documentation is located here

如果您確實想爲您所談論的內容使用ViewPager,請查看指向Android開發人員參考的鏈接。不過,聽起來像是你想做更類似於what's discussed in this Q/A的事情。也許你可以詳細說明你想要完成的事情?

+0

我已經通過鏈接,我已經完成了我的研究並獲得了輸出。謝謝..:) –