本文整理汇总了Java中android.support.v7.widget.Toolbar.setSubtitleTextColor方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.setSubtitleTextColor方法的具体用法?Java Toolbar.setSubtitleTextColor怎么用?Java Toolbar.setSubtitleTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.setSubtitleTextColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initToolBar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void initToolBar() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolBarButton = (TextView) findViewById(R.id.toolbar_button);
if (mToolbar != null) {
mToolbar.setTitleTextAppearance(this, R.style.ToolbarTitleAppearance);
mToolbar.setTitle(getToolbarTitle());
mToolbar.setNavigationIcon(R.drawable.ic_arrow_left_navbar);
mToolbar.setNavigationOnClickListener(this);
mToolbar.setSubtitleTextAppearance(this, R.style.ToolbarSubTitleAppearance);
mToolbar.setSubtitleTextColor(getResources().getColor(R.color.label_grey));
if(getToolBarMenu() != 0){
mToolbar.inflateMenu(getToolBarMenu());
}
mToolbar.setTitleTextColor(getResources().getColor(R.color.white));
}
}
示例2: initUI
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void initUI() {
final AppBarLayout appbarMovieTopChild = (AppBarLayout) findViewById(R.id.appbar_movie_top_child);
ivBaseTitlebarBg = (ImageView) findViewById(R.id.img_item_bg);
ivOnePhoto = (ImageView) findViewById(R.id.iv_one_photo);
tvOneRatingRate = (TextView) findViewById(R.id.tv_one_rating_rate);
tvOneRatingNumber = (TextView) findViewById(R.id.tv_one_rating_number);
tvOneGenres = (TextView) findViewById(R.id.tv_one_genres);
tvOneDay = (TextView) findViewById(R.id.tv_one_day);
tvOneCity = (TextView) findViewById(R.id.tv_one_city);
tvFormerly = (TextView) findViewById(R.id.tv_formerly);
toolbarDoubanDetail = (Toolbar) findViewById(R.id.toolbar_douban_detail);
initToolBar(toolbarDoubanDetail, "");
appbarMovieTopChild.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (appbarMovieTopChild.getBottom() > toolbarDoubanDetail.getBottom() ) {
toolbarDoubanDetail.setBackgroundColor(getResources().getColor(R.color.translucent));
} else {
toolbarDoubanDetail.setBackgroundResource(R.color.colorTheme);
}
}
});
subjectsBean = (HotMovieBean.SubjectsBean) getIntent().getSerializableExtra("bean");
if (subjectsBean != null) {
toolbarDoubanDetail.setTitle(subjectsBean.getTitle());
toolbarDoubanDetail.setSubtitleTextColor(Color.WHITE);
setImgHeaderBg(subjectsBean.getImages().getMedium());
GlideUtils.loadMovieTopImg(ivOnePhoto, subjectsBean.getImages().getLarge());
tvOneRatingRate.setText("评分:" + subjectsBean.getRating().getAverage());
tvOneGenres.setText("类型:" + StringFormatUtil.formatGenres(subjectsBean.getGenres()));
tvOneDay.setText("上映日期:" + subjectsBean.getYear());
//电影详情的id
id = subjectsBean.getId();
}
}
示例3: colorizeToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
* Use this method to colorize toolbar icons to the desired target color
*
* @param toolbarView toolbar view being colored
* @param toolbarIconsColor the target color of toolbar icons
* @param activity reference to activity needed to register observers
*/
public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor, Activity activity) {
final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.MULTIPLY);
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
//Step 1 : Changing the color of back button (or open drawer button).
if (v instanceof ImageButton) {
//Action Bar back button
((ImageButton) v).getDrawable().setColorFilter(colorFilter);
}
if (v instanceof ActionMenuView) {
for (int j = 0; j < ((ActionMenuView) v).getChildCount(); j++) {
//Step 2: Changing the color of any ActionMenuViews - icons that are not back button, nor text, nor overflow menu icon.
//Colorize the ActionViews -> all icons that are NOT: back button | overflow menu
final View innerView = ((ActionMenuView) v).getChildAt(j);
if (innerView instanceof ActionMenuItemView) {
for (int k = 0; k < ((ActionMenuItemView) innerView).getCompoundDrawables().length; k++) {
if (((ActionMenuItemView) innerView).getCompoundDrawables()[k] != null) {
final int finalK = k;
//Important to set the color filter in seperate thread, by adding it to the message queue
//Won't work otherwise.
innerView.post(new Runnable() {
@Override
public void run() {
((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter);
}
});
}
}
}
}
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(toolbarIconsColor);
toolbarView.setSubtitleTextColor(toolbarIconsColor);
//Step 4: Changing the color of the Overflow Menu icon.
setOverflowButtonColor(activity, colorFilter);
}
}
示例4: colorizeToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
* Use this method to colorize toolbar icons to the desired target color
*
* @param toolbarView toolbar view being colored
* @param toolbarIconsColor the target color of toolbar icons
* @param activity reference to activity needed to register observers
*/
public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor, Activity activity) {
final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.MULTIPLY);
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
//Step 1 : Changing the color of back button (or open drawer button).
if (v instanceof ImageButton) {
//Action Bar back button
((ImageButton) v).getDrawable().setColorFilter(colorFilter);
}
if (v instanceof ActionMenuView) {
for (int j = 0; j < ((ActionMenuView) v).getChildCount(); j++) {
//Step 2: Changing the color of any ActionMenuViews - icons that are not back button, nor text, nor overflow menu icon.
//Colorize the ActionViews -> all icons that are NOT: back button | overflow menu
final View innerView = ((ActionMenuView) v).getChildAt(j);
if (innerView instanceof ActionMenuItemView) {
for (int k = 0; k < ((ActionMenuItemView) innerView).getCompoundDrawables().length; k++) {
if (((ActionMenuItemView) innerView).getCompoundDrawables()[k] != null) {
final int finalK = k;
//Important to set the color filter in seperate thread, by adding it to the message queue
//Won't work otherwise.
innerView.post(() -> ((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter));
}
}
}
}
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(ThemeStore.textColorPrimary(activity));
toolbarView.setSubtitleTextColor(ThemeStore.textColorSecondary(activity));
//Step 4: Changing the color of the Overflow Menu icon.
setOverflowButtonColor(activity, colorFilter);
}
}