Java Code Examples for com.google.android.material.tabs.TabLayout#setBackgroundColor()

The following examples show how to use com.google.android.material.tabs.TabLayout#setBackgroundColor() . 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: GiphyActivity.java    From mollyim-android with GNU General Public License v3.0 7 votes vote down vote up
private void initializeResources() {
  ViewPager viewPager = ViewUtil.findById(this, R.id.giphy_pager);
  TabLayout tabLayout = ViewUtil.findById(this, R.id.tab_layout);

  this.gifFragment     = new GiphyGifFragment();
  this.stickerFragment = new GiphyStickerFragment();
  this.forMms          = getIntent().getBooleanExtra(EXTRA_IS_MMS, false);

  gifFragment.setClickListener(this);
  stickerFragment.setClickListener(this);

  viewPager.setAdapter(new GiphyFragmentPagerAdapter(this, getSupportFragmentManager(),
                                                     gifFragment, stickerFragment));
  tabLayout.setupWithViewPager(viewPager);
  tabLayout.setBackgroundColor(getConversationColor());
}
 
Example 2
Source File: MainActivity.java    From YouTube-In-Background with MIT License 6 votes vote down vote up
/**
 * Save app theme color in preferences
 */
private void setColors(int backgroundColor, int textColor)
{
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(backgroundColor);
    toolbar.setTitleTextColor(textColor);
    TabLayout tabs = (TabLayout) findViewById(R.id.tabs);
    tabs.setBackgroundColor(backgroundColor);
    tabs.setTabTextColors(textColor, textColor);
    SharedPreferences sp = PreferenceManager
            .getDefaultSharedPreferences(this);
    sp.edit().putInt("BACKGROUND_COLOR", backgroundColor).apply();
    sp.edit().putInt("TEXT_COLOR", textColor).apply();

    initialColors[0] = backgroundColor;
    initialColors[1] = textColor;
}
 
Example 3
Source File: DownloadDetailsActivity.java    From EdXposedManager with GNU General Public License v3.0 5 votes vote down vote up
private void setupTabs() {
    mPager = findViewById(R.id.download_pager);
    mPager.setAdapter(new SwipeFragmentPagerAdapter(getSupportFragmentManager(), BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT));
    TabLayout mTabLayout = findViewById(R.id.sliding_tabs);
    mTabLayout.setupWithViewPager(mPager);
    mTabLayout.setBackgroundColor(XposedApp.getColor(this));
}
 
Example 4
Source File: BaseActivity.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void applyTabLayoutTheme(TabLayout tabLayout) {
    int toolbarAndTabBackgroundColor = customThemeWrapper.getColorPrimary();
    tabLayout.setBackgroundColor(toolbarAndTabBackgroundColor);
    tabLayout.setSelectedTabIndicatorColor(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator());
    tabLayout.setTabTextColors(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(),
            customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor());
}
 
Example 5
Source File: ThemePreviewActivity.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void applyTabLayoutTheme(TabLayout tabLayout) {
    int toolbarAndTabBackgroundColor = customTheme.colorPrimary;
    tabLayout.setBackgroundColor(toolbarAndTabBackgroundColor);
    tabLayout.setSelectedTabIndicatorColor(customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator);
    tabLayout.setTabTextColors(customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor,
            customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor);
}