Java Code Examples for android.support.v4.view.PagerTabStrip#setTabIndicatorColor()

The following examples show how to use android.support.v4.view.PagerTabStrip#setTabIndicatorColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListPagerFragment.java    From recyclerViewToTheRescue with MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_viewpager, container, false);

    viewPager = (ViewPager)rootView.findViewById(R.id.view_pager);
    viewPager.setAdapter(new ListPagerAdapter(getChildFragmentManager()));

    tabStrip = (PagerTabStrip)rootView.findViewById(R.id.tab_strip);
    tabStrip.setBackgroundColor(getResources().getColor(R.color.toolbar_background));
    tabStrip.setTextColor(getResources().getColor(R.color.dark_text));
    tabStrip.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.textSizeTC3));
    tabStrip.setTabIndicatorColor(getResources().getColor(R.color.rdio_blue));

    return rootView;
}
 
Example 2
Source File: MainActivity.java    From ksyhttpcache_android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    titlelist = new ArrayList<String>();

    fraglist = new ArrayList<Fragment>();
    urlFragment = new URLFragment();
    cacheFragment = new CacheFragment();
    settingFragment = new SettingFragment();
    cachingFragment = new CachingFragment();
    fraglist.add(cacheFragment);
    fraglist.add(cachingFragment);
    fraglist.add(urlFragment);
    fraglist.add(settingFragment);


    pager_tab = (PagerTabStrip)findViewById(R.id.pager_tab);
    pager_tab.setTabIndicatorColor(getResources().getColor(R.color.colorAccent));

    pager_tab.setDrawFullUnderline(false);
    pager_tab.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
    pager_tab.setTextSpacing(50);

    titlelist.add("已完成");
    titlelist.add("未完成");
    titlelist.add("播放");
    titlelist.add("设置");

    viewPager = (ViewPager)findViewById(R.id.my_viewpager);
    verifyStoragePermissions(this);
}
 
Example 3
Source File: RFABGroupSampleActivity.java    From RapidFloatingActionButton with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.rfab_group_sample);
    pts = (PagerTabStrip) findViewById(R.id.rfab_group_sample_pts);
    pager = (ViewPager) findViewById(R.id.rfab_group_sample_vp);
    rfabGroup = (RapidFloatingActionButtonGroup) findViewById(R.id.rfab_group_sample_rfabg);

    rfabGroup.setOnRapidFloatingButtonGroupListener(this);

    pts.setTabIndicatorColor(Color.RED);
    pts.setTextColor(0xff3f51b5);

    fragments.add(new FragmentA());
    fragments.add(new FragmentB());
    fragments.add(new FragmentC());

    pager.setAdapter(new MyPageAdapter(getSupportFragmentManager()));

    pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            rfabGroup.setSection(position);
        }
    });
    pager.setOffscreenPageLimit(3);

}
 
Example 4
Source File: ListsFragment.java    From twitt4droid with Apache License 2.0 5 votes vote down vote up
private void setUpLayout(View layout) {
    viewPager = (ViewPager) layout.findViewById(R.id.view_pager);
    pagerStrip = (PagerTabStrip) layout.findViewById(R.id.pager_strip);
    adapter = new SwipeTimelineFragmentPagerAdapter();
    viewPager.setAdapter(adapter);
    pagerStrip.setDrawFullUnderline(false);
    pagerStrip.setTabIndicatorColor(getResources().getColor(R.color.twitt4droid_primary_color));
}
 
Example 5
Source File: AppOpsSummary.java    From AppOpsXposed with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // initialize the inflater
    mInflater = inflater;

    View rootView = mInflater.inflate(R.layout.app_ops_summary,
            container, false);
    mContentContainer = container;
    mRootView = rootView;

    mPageNames = getResources().getTextArray(R.array.app_ops_categories);

    mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
    MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager());
    mViewPager.setAdapter(adapter);
    mViewPager.setOnPageChangeListener(adapter);
    PagerTabStrip tabs = (PagerTabStrip) rootView.findViewById(R.id.tabs);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        tabs.setTabIndicatorColorResource(android.R.color.holo_blue_light);
    } else {
        final TypedValue val = new TypedValue();
        getActivity().getTheme().resolveAttribute(android.R.attr.colorAccent, val, true);
        tabs.setTabIndicatorColor(val.data);
    }

    // We have to do this now because PreferenceFrameLayout looks at it
    // only when the view is added.
    if (container != null && "android.preference.PreferenceFrameLayout".equals(container.getClass().getName())) {
        new ObjectWrapper(rootView.getLayoutParams()).set("removeBorders", true);
    }

    return rootView;
}