Java Code Examples for com.android.settings.widget.SlidingTabLayout

Following code examples demonstrate how to use com.android.settings.widget.SlidingTabLayoutfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.android.settings.widget.SlidingTabLayoutand various code implementation of this class.

    public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
        final View content = inflater.inflate(R.layout.dashboard_container, parent, false);
        mViewPager = (RtlCompatibleViewPager) content.findViewById(R.id.pager);
        mPagerAdapter = new DashboardViewPagerAdapter(getContext(),
                getChildFragmentManager(), mViewPager);
        mViewPager.setAdapter(mPagerAdapter);
        mViewPager.addOnPageChangeListener(
                new TabChangeListener((SettingsActivity) getActivity()));

        final String selectedTab = getArguments().
            getString(EXTRA_SELECT_SETTINGS_TAB, ARG_SUMMARY_TAB);
        if (TextUtils.equals(selectedTab, ARG_SUPPORT_TAB)) {
            mViewPager.setCurrentItem(INDEX_SUPPORT_FRAGMENT);
        } else {
            mViewPager.setCurrentItem(INDEX_SUMMARY_FRAGMENT);
        }

        mHeaderView = inflater.inflate(R.layout.dashboard_container_header, parent, false);
        ((SlidingTabLayout) mHeaderView).setViewPager(mViewPager);
        return content;
    } 


Advertisement
Javadoc
To be used with ViewPager to provide a tab indicator component which give constant feedback as to th

e user's scroll progress.

Read More
Advertisement