本文整理了Java中androidx.appcompat.widget.Toolbar.setTitleTextColor()
方法的一些代码示例,展示了Toolbar.setTitleTextColor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setTitleTextColor()
方法的具体详情如下:
包路径:androidx.appcompat.widget.Toolbar
类名称:Toolbar
方法名:setTitleTextColor
暂无
代码示例来源:origin: mikepenz/AboutLibraries
toolbar.setTitleTextColor(Color.WHITE);
toolbar.setSubtitleTextColor(Color.WHITE);
代码示例来源:origin: AppIntro/AppIntro
tb.setTitleTextColor(Color.parseColor("#FFFFFF"));
代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD
private void setAppBarLayoutAlpha(int alpha) {
if (isForeground()) return;
Activity activity;
if ((activity = getActivity()) != null && mAppBarLayout != null && mToolBar != null) {
int colorPrimary = ViewUtils.getColorPrimaryColor(activity);
mAppBarLayout.setBackgroundDrawable(new ColorDrawable(Color.argb(alpha, Color.red(colorPrimary),
Color.green(colorPrimary), Color.blue(colorPrimary))));
mToolBar.setTitleTextColor(Color.argb(alpha, 255, 255, 255));
}
}
代码示例来源:origin: Gwokhov/Deadline
public static void setupActionBar(Activity activity, boolean isLightBar, int bgColorRes, int bgColorRes2, int titleRes, Toolbar toolbar) {
Window window = activity.getWindow();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
window.setStatusBarColor(activity.getResources().getColor(bgColorRes2));
if (!isLightBar) {
toolbar.setTitleTextColor(activity.getResources().getColor(R.color.white));
}
} else {
window.setStatusBarColor(activity.getResources().getColor(bgColorRes, null));
if (isLightBar) {
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
} else {
toolbar.setTitleTextColor(activity.getResources().getColor(R.color.white));
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
toolbar.setTitle(activity.getString(titleRes));
((AppCompatActivity) activity).setSupportActionBar(toolbar);
ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowHomeEnabled(true);
}
}
代码示例来源:origin: michael-rapp/AndroidPreferenceActivity
/**
* Obtains the color of the toolbar's title from a specific typed array.
*
* @param theme
* The resource id of the theme, which should be applied on the toolbar, as an {@link
* Integer} value
*/
private void obtainTitleColor(final int theme) {
TypedArray typedArray = getContext().getTheme()
.obtainStyledAttributes(theme, new int[]{android.R.attr.textColorPrimary});
int textColorPrimary = typedArray.getResourceId(0, 0);
typedArray.recycle();
if (textColorPrimary != 0) {
int titleColor = ContextCompat.getColor(getContext(), textColorPrimary);
toolbar.setTitleTextColor(titleColor);
}
}
代码示例来源:origin: h4h13/RetroMusicPlayer
toolbar.setTitleTextColor(titleTextColor);
toolbar.setSubtitleTextColor(subtitleTextColor);
代码示例来源:origin: MCMrARM/revolution-irc
static void setupTheming(Toolbar toolbar, LiveThemeComponent component, AttributeSet attrs, int defStyleAttr) {
Resources.Theme t = component.getTheme();
StyledAttributesHelper r = StyledAttributesHelper.obtainStyledAttributes(toolbar.getContext(), t, attrs, THEME_ATTRS, defStyleAttr);
StyledAttributesHelper textAppearance = r.obtainChildAttrs(t, R.attr.titleTextAppearance, ThemedTextView.TEXT_APPEARANCE_ATTRS);
component.addColorAttr(textAppearance, android.R.attr.textColor, toolbar::setTitleTextColor, (ColorStateList l) -> toolbar.setTitleTextColor(l.getDefaultColor()));
textAppearance.recycle();
r.recycle();
}
代码示例来源:origin: h4h13/RetroMusicPlayer
toolbarView.setTitleTextColor(ThemeStore.Companion.textColorPrimary(activity));
toolbarView.setSubtitleTextColor(ThemeStore.Companion.textColorSecondary(activity));
内容来源于网络,如有侵权,请联系作者删除!