當前位置: 首頁>>代碼示例>>Java>>正文


Java TabLayout.setTabTextColors方法代碼示例

本文整理匯總了Java中android.support.design.widget.TabLayout.setTabTextColors方法的典型用法代碼示例。如果您正苦於以下問題:Java TabLayout.setTabTextColors方法的具體用法?Java TabLayout.setTabTextColors怎麽用?Java TabLayout.setTabTextColors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.design.widget.TabLayout的用法示例。


在下文中一共展示了TabLayout.setTabTextColors方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.activity_dual_tab_photos, container, false);
    ((AppCompatActivity) getActivity()).setSupportActionBar(root.findViewById(R.id.toolbar));

    TabLayout tabLayout = root.findViewById(R.id.tablayout);
    tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
    int tabColorPrimary = CurrentTheme.getPrimaryTextColorOnColoredBackgroundCode(getActivity());
    int tabColorSecondary = CurrentTheme.getSecondaryTextColorOnColoredBackgroundCode(getActivity());
    tabLayout.setTabTextColors(tabColorSecondary, tabColorPrimary);

    ViewPager viewPager = root.findViewById(R.id.view_pager);
    viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
        @Override
        public void onPageSelected(int position) {
            mCurrentTab = position;
        }
    });

    mPagerAdapter = new Adapter(getChildFragmentManager(), mSources);
    viewPager.setAdapter(mPagerAdapter);

    tabLayout.setupWithViewPager(viewPager, true);
    return root;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:27,代碼來源:DualTabPhotosFragment.java

示例2: onViewCreated

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
    ViewPager viewPager = view.findViewById(R.id.viewpager);
    viewPager.setOffscreenPageLimit(1);
    setupViewPager(viewPager);

    TabLayout tabLayout = view.findViewById(R.id.tablayout);
    tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
    tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);

    int tabColorPrimary = CurrentTheme.getPrimaryTextColorOnColoredBackgroundCode(getActivity());
    int tabColorSecondary = CurrentTheme.getSecondaryTextColorOnColoredBackgroundCode(getActivity());
    tabLayout.setTabTextColors(tabColorSecondary, tabColorPrimary);
    tabLayout.setupWithViewPager(viewPager);

    if(getArguments().containsKey(Extra.TAB)){
        int tab = getArguments().getInt(Extra.TAB);
        getArguments().remove(Extra.TAB);
        viewPager.setCurrentItem(tab);
    }
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:22,代碼來源:FaveTabsFragment.java

示例3: onCreateView

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.content_notifications, container, false);

    AppBarLayout appBarLayout = getActivity().findViewById(R.id.appbar);

    if (appBarLayout.getChildCount() == 1) {
        mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());

        mViewPager = rootView.findViewById(R.id.tab_container);
        mViewPager.setAdapter(mSectionsPagerAdapter);

        mTabLayout = new TabLayout(getActivity());
        mTabLayout.setTabTextColors(
                getResources().getColor(R.color.disabledGrey),
                getResources().getColor(R.color.white)
        );
        mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
        mTabLayout.setupWithViewPager(mViewPager);

        appBarLayout.addView(mTabLayout);
    }

    return rootView;
}
 
開發者ID:dhbw-timetable,項目名稱:dhbw-timetable-android,代碼行數:26,代碼來源:NotificationsFragment.java

示例4: initializeAnalytics

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
/**
 * Initialize analytics fragment
 */
private void initializeAnalytics() {
    setTitle(getResources().getString(R.string.analytics));
    removeTabs();
    if (this.menu != null) this.menu.findItem(R.id.action_change_day).setVisible(true);
    fab.setVisibility(View.GONE);

    tabs = new TabLayout(MainActivity.this);
    tabs.setTabTextColors(Color.parseColor("#FFFFFF"), Color.parseColor("#FFFFFF"));
    appBar.addView(tabs);

    ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    FragmentAdapter adapter = new FragmentAdapter(getSupportFragmentManager());
    adapter.addFragment(new AnalyticsDayFragment(MainActivity.this, restaurantId), getString(R.string.per_day));
    adapter.addFragment(new AnalyticsWeekFragment(MainActivity.this, restaurantId), getString(R.string.per_week));
    adapter.addFragment(new AnalyticsMonthFragment(MainActivity.this, restaurantId), getString(R.string.per_month));
    viewPager.setAdapter(adapter);
    tabs.setupWithViewPager(viewPager);
}
 
開發者ID:Wisebite,項目名稱:wisebite_android,代碼行數:22,代碼來源:MainActivity.java

示例5: initTab

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
public void initTab(TabLayout tabLayout) {
    tabLayout.setTabMode(TabLayout.MODE_FIXED);
    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    tabLayout.setBackgroundColor(getContext().getResources().getColor(R.color.colorPrimary));
    tabLayout.setSelectedTabIndicatorColor(Color.WHITE);
    tabLayout.setTabTextColors(ColorStateList.valueOf(Color.WHITE));
}
 
開發者ID:Mindjet,項目名稱:LiteReader,代碼行數:9,代碼來源:DoubanMovieMoreReviewViewModel.java

示例6: onCreateView

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_community_control, container, false);
    ((AppCompatActivity) getActivity()).setSupportActionBar(root.findViewById(R.id.toolbar));

    ViewPager pager = root.findViewById(R.id.view_pager);
    pager.setOffscreenPageLimit(2);

    List<ITab> tabs = new ArrayList<>();
    tabs.add(new Tab(getString(R.string.community_blacklist_tab_title), () -> CommunityBlacklistFragment.newInstance(mAccountId, mCommunity.getId())));
    tabs.add(new Tab(getString(R.string.community_links_tab_title), () -> CommunityLinksFragment.newInstance(mAccountId, mCommunity.getId())));

    if(mCommunity.getAdminLevel() >= VKApiCommunity.AdminLevel.ADMIN){
        tabs.add(new Tab(getString(R.string.community_managers_tab_title), () -> CommunityManagersFragment.newInstance(mAccountId, mCommunity.getId())));
    }

    pager.setAdapter(new Adapter(tabs, getChildFragmentManager()));

    TabLayout tabLayout = root.findViewById(R.id.tablayout);

    int tabColorPrimary = CurrentTheme.getPrimaryTextColorOnColoredBackgroundCode(getActivity());
    int tabColorSecondary = CurrentTheme.getSecondaryTextColorOnColoredBackgroundCode(getActivity());

    tabLayout.setTabTextColors(tabColorSecondary, tabColorPrimary);
    tabLayout.setupWithViewPager(pager);
    return root;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:29,代碼來源:CommunityControlFragment.java

示例7: onViewCreated

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
    ViewPager viewPager = view.findViewById(R.id.fragment_videos_pager);
    setupViewPager(viewPager);

    TabLayout tabLayout = view.findViewById(R.id.fragment_videos_tabs);
    tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
    int tabColorPrimary = CurrentTheme.getPrimaryTextColorOnColoredBackgroundCode(getActivity());
    int tabColorSecondary = CurrentTheme.getSecondaryTextColorOnColoredBackgroundCode(getActivity());
    tabLayout.setTabTextColors(tabColorSecondary, tabColorPrimary);
    tabLayout.setupWithViewPager(viewPager);
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:13,代碼來源:VideosTabsFragment.java

示例8: onCreate

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    pager = (ViewPager) findViewById(R.id.pager);
    tabLayout = (TabLayout) findViewById(R.id.tab_layout);
    pager.setAdapter(new ExcelPagerAdapter(getSupportFragmentManager()));
    tabLayout.setupWithViewPager(pager);
    tabLayout.setTabTextColors(Color.WHITE,Color.WHITE);
}
 
開發者ID:zhouchaoyuan,項目名稱:excelPanel,代碼行數:11,代碼來源:MainActivity.java

示例9: onCreateView

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_channel, container, false);

    TabLayout tabStrip = view.findViewById(R.id.channelTabLayout);
    tabStrip.setSelectedTabIndicatorColor(getColor(getContext(), R.color.tabText));
    tabStrip.setTabTextColors(getColor(getContext(), R.color.tabText), getColor(getContext(), R.color.tabText));
    tabStrip.setupWithViewPager((ViewPager)view.findViewById(R.id.pager));

    final Button followButton = view.findViewById(R.id.followButton);
    if(following)
        followButton.setBackground(getDrawable(getContext(), R.drawable.ic_favorite_black_24dp));

    followButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(following) {
                unfollow();
                followButton.setBackground(getDrawable(getContext(), R.drawable.ic_favorite_border_black_24dp));
            } else {
                follow();
                followButton.setBackground(getDrawable(getContext(), R.drawable.ic_favorite_black_24dp));
            }
        }
    });

    return view;
}
 
開發者ID:invghost,項目名稱:NeoStream,代碼行數:30,代碼來源:ChannelFragment.java

示例10: theme

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
private void theme(View root) {
        int colorPrimary = getResources().getColor(R.color.colorPrimary);
        int accentColor = getResources().getColor(R.color.colorAccent);
        boolean isPrimaryDark = true;
        int contentColor = GeneralUtils.resolveColor(getContext(), android.R.attr.textColorPrimaryInverse, 0);

        root.findViewById(R.id.top_bar_house).setBackgroundColor(colorPrimary);
        ((TextView) root.findViewById(R.id.single_storage_item_text_view)).setTextColor(contentColor);

        TabLayout tabLayout = (TabLayout) root.findViewById(R.id.tab_layout);
        tabLayout.setBackgroundColor(colorPrimary);
        tabLayout.setTabTextColors(ColorUtil.withAlpha(contentColor, .75f), contentColor);
        tabLayout.setSelectedTabIndicatorColor(contentColor);
        try {
            for (int i = 0; i < tabLayout.getTabCount(); i++) {
                TabLayout.Tab tab = tabLayout.getTabAt(i);
                Field fTabView = TabLayout.Tab.class.getDeclaredField("mView");
                fTabView.setAccessible(true);
                View tabView = (View) fTabView.get(tab);
                GeneralUtils.setBackgroundDrawable(tabView, MaterialValueHelper.getSelectableItemBackground(getActivity(), isPrimaryDark, false));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


        TintHelper.setTint((ImageView) root.findViewById(R.id.up_button), GeneralUtils.resolveColor(getActivity(), android.R.attr.textColorPrimaryInverse, 0));
        ((TextView) root.findViewById(R.id.cancel)).setTextColor(accentColor);
        ((TextView) root.findViewById(R.id.choose)).setTextColor(accentColor);

//        ATH.setStatusbarColor(d.getWindow(), ColorUtil.darkenColor(colorPrimary));
    }
 
開發者ID:GlennioTech,項目名稱:MetadataEditor,代碼行數:33,代碼來源:FolderPickerDialog.java

示例11: insertTabs

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
private void insertTabs(ViewGroup container) {
    View rootView = (View) container.getParent();
    appBar = (AppBarLayout) rootView.findViewById(R.id.appbar);
    tabs = new TabLayout(getActivity());
    tabs.setTabTextColors(Color.parseColor("#FFFFFF"), Color.parseColor("#FFFFFF"));
    appBar.addView(tabs);
}
 
開發者ID:kflauri2312lffds,項目名稱:Android_watch_magpie,代碼行數:8,代碼來源:PhysioParamFragment.java

示例12: process

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
public void process(@NonNull Context context, @Nullable String key, @NonNull View view, @NonNull String suffix) {
    final TabLayout tl = (TabLayout) view;
    final ColorResult result = getColorFromSuffix(context, key, view, suffix);
    if (result == null) return;
    final int color = result.getColor();

    if (mTextMode) {
        tl.setTabTextColors(ATEUtil.adjustAlpha(color, UNFOCUSED_ALPHA), color);
    } else if (mIndicatorMode) {
        tl.setSelectedTabIndicatorColor(color);

        final ColorStateList sl = new ColorStateList(new int[][]{
                new int[]{-android.R.attr.state_selected},
                new int[]{android.R.attr.state_selected}
        },
                new int[]{
                        ATEUtil.adjustAlpha(color, UNFOCUSED_ALPHA),
                        color
                });
        for (int i = 0; i < tl.getTabCount(); i++) {
            final TabLayout.Tab tab = tl.getTabAt(i);
            if (tab != null && tab.getIcon() != null)
                tab.setIcon(TintHelper.createTintedDrawable(tab.getIcon(), sl));
        }
    }
}
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:28,代碼來源:TabLayoutTagProcessor.java

示例13: initTabLayout

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
protected void initTabLayout(TabLayout tabLayout) {
    tabLayout.setBackgroundColor(getContext().getResources().getColor(R.color.colorPrimary));
    tabLayout.setSelectedTabIndicatorColor(Color.WHITE);
    tabLayout.setTabTextColors(ColorStateList.valueOf(Color.WHITE));
}
 
開發者ID:Mindjet,項目名稱:LiteReader,代碼行數:7,代碼來源:MainViewModel.java

示例14: onCreateView

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_search_tabs, container, false);
    mViewPager = root.findViewById(R.id.viewpager);

    int tabColorPrimary = CurrentTheme.getPrimaryTextColorOnColoredBackgroundCode(getActivity());
    int tabColorSecondary = CurrentTheme.getSecondaryTextColorOnColoredBackgroundCode(getActivity());

    TabLayout tabLayout = root.findViewById(R.id.tablayout);
    tabLayout.setTabTextColors(tabColorSecondary, tabColorPrimary);

    mSearchView = root.findViewById(R.id.searchview);
    mSearchView.setOnQueryTextListener(this);
    mSearchView.setOnBackButtonClickListener(this);
    mSearchView.setOnAdditionalButtonClickListener(this);
    mSearchView.setQuery(getInitialCriteriaText(), true);

    mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            mCurrentTab = position;

            syncChildFragment();
            resolveViewPagerBackgroundColor();
        }
    });

    if (mViewPager.getBackground() != null && mViewPager.getBackground() instanceof ColorDrawable) {
        mCurrentViewPagerBackgroundColor = ((ColorDrawable) mViewPager.getBackground()).getColor();
    }

    resolveLeftButton();

    mAdapter = new Adapter(getChildFragmentManager());
    mViewPager.setAdapter(mAdapter);
    mViewPager.setOffscreenPageLimit(1);

    tabLayout.setupWithViewPager(mViewPager);

    if (getArguments().containsKey(Extra.TAB)) {
        mCurrentTab = getArguments().getInt(Extra.TAB);

        getArguments().remove(Extra.TAB);
        mViewPager.setCurrentItem(mCurrentTab);
    }

    resolveViewPagerBackgroundColor();
    return root;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:50,代碼來源:SeachTabsFragment.java

示例15: changeTextColor

import android.support.design.widget.TabLayout; //導入方法依賴的package包/類
private void changeTextColor() {

        //disable search mode for tabLayout
        disableSearchMode();

        TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);

        tabLayout.setTabTextColors(slightDarken(mTextColor), mTextColor);
        mToolbar.setTitleTextColor(mTextColor);

        Drawable myFabSrc = getResources().getDrawable(R.drawable.add);
        Drawable newColorDrawable = changeDrawableColor(myFabSrc, mTextColor);

        mFab.setImageDrawable(newColorDrawable);

        ToolbarColorizeHelper.colorizeToolbar(mToolbar, mTextColor, this);

        if (rightDrawer != null) {
            mColorItem3.withIconColor(mTextColor);
            rightDrawer.updateItem(mColorItem3);
        }

    }
 
開發者ID:IdeaTrackerPlus,項目名稱:IdeaTrackerPlus,代碼行數:24,代碼來源:MainActivity.java


注:本文中的android.support.design.widget.TabLayout.setTabTextColors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。