本文整理汇总了Java中android.support.design.widget.TabLayout.setSelectedTabIndicatorColor方法的典型用法代码示例。如果您正苦于以下问题:Java TabLayout.setSelectedTabIndicatorColor方法的具体用法?Java TabLayout.setSelectedTabIndicatorColor怎么用?Java TabLayout.setSelectedTabIndicatorColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.TabLayout
的用法示例。
在下文中一共展示了TabLayout.setSelectedTabIndicatorColor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeSecondaryColor
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
private void changeSecondaryColor() {
//disable search mode for tabLayout
disableSearchMode();
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
tabLayout.setSelectedTabIndicatorColor(mSecondaryColor);
mFab.setBackgroundTintList(ColorStateList.valueOf(mSecondaryColor));
if (rightDrawer != null) {
mColorItem2.withIconColor(mSecondaryColor);
rightDrawer.updateItem(mColorItem2);
}
RecyclerOnClickListener.setSecondaryColor(mSecondaryColor);
}
示例2: 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));
}
示例3: 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;
}
示例4: 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));
}
示例5: 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));
}
}
}
示例6: initTab
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
private void initTab() {
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setSelectedTabIndicatorColor(getResources().getColor(R.color.colorIndivateTab));
setupViewPager(viewPager);
tabLayout.setupWithViewPager(viewPager);
setupTabIcons();
}
示例7: 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));
}
示例8: initView
import android.support.design.widget.TabLayout; //导入方法依赖的package包/类
private void initView() {
getWindow().setBackgroundDrawable(null);
addpage(new AiXiaFragment(), "爱下");
addpage(new ZhiXuanFragment(), "知轩藏书");
addpage(new ZhouDuFragment(), "周读");
addpage(new ShuYuZheFragment(), "书语者");
addpage(new DongManZhiJiaFragment(), "动漫之家");
addpage(new M360DFragment(), "360℃");
addpage(new XiaoShuWuFragment(), "我的小书屋");
addpage(new QiShuFragment(), "奇书");
addpage(new BlahFragment(), "blah");
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
final TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
mPagerAdapter = new PagerAdapter(getSupportFragmentManager(), fragments, titles);
viewPager.setAdapter(mPagerAdapter);
viewPager.setOffscreenPageLimit(fragments.size());
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
searchView.findFocus();
mPagerAdapter.setTop(tabLayout.getSelectedTabPosition());
}
});
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("dark_theme", false)) {
tabLayout.setSelectedTabIndicatorColor(getResources().getColor(R.color.DarkColor));
tabLayout.setTabTextColors(tabLayout.getTabTextColors().getDefaultColor(), getResources().getColor(R.color.DarkColor));
}
}