本文整理汇总了Java中android.support.design.widget.TabLayout.setBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:Java TabLayout.setBackgroundColor方法的具体用法?Java TabLayout.setBackgroundColor怎么用?Java TabLayout.setBackgroundColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.TabLayout
的用法示例。
在下文中一共展示了TabLayout.setBackgroundColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
示例2: 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));
}
示例3: 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));
}