Android 轻扫和制表 ui - "best practice" 什么是最新的?

Android swipe and tabs ui - what is "best practice" and up to date?

我以前经常用的“Android ActionBar FragmentPagerAdapterViewPager”好像有点格格不入日期 - 是否有更新、更多 advanced/better guideline/technique 来做这些事情?

Android 4.4

例如:

private ViewPager viewPager;
private TabsPagerAdapter mAdapter;
private ActionBar actionBar;

和 TabsPagerAdapter class:

public class TabsPagerAdapter extends FragmentPagerAdapter {

    FrontEndController context;
    WearListFragment wearListFragment;
    MobileListFragment mobileListFragment;
    FavouriteListFragment favouriteListFragment;
    AdvancedControlFragment advancedControlFragment;
    ControlFragment controlFragment;
    SetupFragment setupFragment;
    StatusFragment statusFragment;

        public TabsPagerAdapter(FragmentManager fm,FrontEndController context) {
            super(fm);
            this.context =context;

        }

    // "Setup", "Advanced","Favourite","Status","Control", "Mobile", "Wear"

    @Override
        public Fragment getItem(int index) {

            switch (index) {
                case 0:
                    //Setup
                    setupFragment = new SetupFragment();
                    setupFragment.setContext(context);
                    return setupFragment;

                case 1:
                    advancedControlFragment = new AdvancedControlFragment();
                    advancedControlFragment.setContext(context);
                    return advancedControlFragment;


                case 2:
                    favouriteListFragment= new FavouriteListFragment();
                    favouriteListFragment.setContext(context,this);
                    return favouriteListFragment;


                case 3:
                    statusFragment = new StatusFragment();
                    statusFragment.setContext(context);
                    return statusFragment;

                case 4:
                    controlFragment = new ControlFragment();
                    controlFragment.setContext(context);
                    return controlFragment;


                case 5:
                    mobileListFragment = new MobileListFragment();
                    mobileListFragment.setContext(context);
                    return mobileListFragment;

                case 6:
                    wearListFragment = new WearListFragment();
                    wearListFragment.setContext(context);
                    return wearListFragment;
            }

            return null;
        }

        @Override
        public int getCount() {
            // get item count - equal to number of tabs
            return 7;
        }

    public WearListFragment getWearListFragment() {
        return wearListFragment;
    }

    public MobileListFragment getMobileListFragment() {
        return mobileListFragment;
    }

    public FavouriteListFragment getFavouriteListFragment() {
        return favouriteListFragment;
    }


}

你有很多可能性:

默认 Android 标签和 viewpager:

Creating Swipe Views with Tabs

插件(推荐):

最有名的:

PagerSlidingTabStrip

实施指南: implement-guide

其他:

List of ViewPager plugs

lollipop 5.0之后,我们主要使用AppCompatActivity,Toolbar..代替ActionBar。 http://developer.android.com/reference/android/widget/Toolbar.html