如何可见的所有关于PagerTabStrip时间3选项卡? [英] How to visible all the time 3 tab on PagerTabStrip?

查看:190
本文介绍了如何可见的所有关于PagerTabStrip时间3选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序它试图实现的android PagerTabStrip上ViewPager.I有三个选项卡
1)TAB1 2)TAB2以及3)TAB3。当TAB1被选中则仅显示TAB1 >> TAB2(pic_01)。当TAB2选择则显示TAB1 >> >> TAB2 TAB3(pic_02)。当TAB3选择则显示TAB2 TAB3 >>(pic_03)。但我想,所有的时间3选项卡会显示在同一时间。这样的选择时TAB1那么它将TAB3 >>> TAB1 >> TAB2作为。同时所选择TAB2那么这将是AB1 >> >> TAB2 TAB3。而当TAB3 slected那么它将被TAB2 TAB3 >> >> Tab1.My试图鳕鱼波纹管我实现。

I have a android application which try to implement android PagerTabStrip on ViewPager.I have three tab 1) Tab1 2)Tab2 and 3) Tab3. When Tab1 are selected then only show Tab1>>Tab2(pic_01).When Tab2 selected then it show Tab1>>Tab2>>Tab3(pic_02). When Tab3 selected then it show Tab2>>Tab3(pic_03).But I want ,all the time 3 tab will be visible at the same time. Such as when Tab1 selected then it will Tab3>>>Tab1>>Tab2. Same as when Tab2 selected then it will be ab1>>Tab2>>Tab3 .and when Tab3 slected then it will be Tab2>>Tab3>>Tab1.My trying cod are bellow which i implement.

   viewPager = (ViewPager) findViewById(R.id.pager);        
    mPagerTabStrip = (PagerTabStrip)findViewById(R.id.PagerTab);
    mPagerTabStrip.setScrollContainer(true);
    // Set the ViewPagerAdapter into ViewPager
    viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));

ViewPagerAdapter是FragmentPagerAdapter类。

ViewPagerAdapter is the FragmentPagerAdapter class.

public class ViewPagerAdapter extends FragmentPagerAdapter {

final int PAGE_COUNT = 3;
// Tab Titles
private String tabtitles[] = new String[] { "Tab1", "Tab2", "Tab3" };
Context context;

public ViewPagerAdapter(FragmentManager fm) {
    super(fm);
}

@Override
public int getCount() {
    return PAGE_COUNT;
}

@Override
public Fragment getItem(int position) {

    Log.w("position", "are:"+position);
    switch (position) {


        // Open FragmentTab1.java
    case 0:
        FragmentTab1 fragmenttab1 = new FragmentTab1();
        return fragmenttab1;

        // Open FragmentTab2.java
    case 1:
        FragmentTab2 fragmenttab2 = new FragmentTab2();
        return fragmenttab2;

        // Open FragmentTab3.java
    case 2:
        FragmentTab3 fragmenttab3 = new FragmentTab3();
        return fragmenttab3;
    }
    return null;
}

@Override
public CharSequence getPageTitle(int position) {
    return tabtitles[position];
}

}

其实我想所有的时间这三个标签将是可见的一样pic_02.Is这可能吗?请帮我。(感谢所有)

推荐答案

答案我不类似的问题'T认为这是可能以 PagerTabStrip 显示在同一时间的所有三个选项卡(当然时的第二个选项卡除外)。它看起来像你将不得不使用动作条或推出自己的标签条。

Per this answer to a similar question I don't think it is possible with a PagerTabStrip to show all three tabs at the same time (except when on the second tab, of course). It looks like you'll have to use ActionBar or roll your own tab strip.

这篇关于如何可见的所有关于PagerTabStrip时间3选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆