android.support.v7.widget.Toolbar.setTitleTextColor()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中android.support.v7.widget.Toolbar.setTitleTextColor()方法的一些代码示例,展示了Toolbar.setTitleTextColor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setTitleTextColor()方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:setTitleTextColor

Toolbar.setTitleTextColor介绍

暂无

代码示例

代码示例来源:origin: scwang90/SmartRefreshLayout

private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
    mToolbar.setBackgroundResource(colorPrimary);
    mToolbar.setTitleTextColor(ContextCompat.getColor(this, android.R.color.white));
    mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
    if (Build.VERSION.SDK_INT >= 21) {
      getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
    }
    if (Build.VERSION.SDK_INT >= 23) {
      Window window = getWindow();
      int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
      systemUiVisibility &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
      window.getDecorView().setSystemUiVisibility(systemUiVisibility);
    }
  }
}

代码示例来源:origin: liuguangqiang/SwipeBack

private void initViews() {
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle(R.string.title_activity_viewpager);
  toolbar.setTitleTextColor(Color.WHITE);
  setSupportActionBar(toolbar);
  ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager_demo);
  TestAdapter adapter = new TestAdapter(getSupportFragmentManager());
  viewPager.setAdapter(adapter);
}

代码示例来源:origin: Yalantis/uCrop

/**
 * Configures and styles both status bar and toolbar.
 */
private void setupAppBar() {
  setStatusBarColor(mStatusBarColor);
  final Toolbar toolbar = findViewById(R.id.toolbar);
  // Set all of the Toolbar coloring
  toolbar.setBackgroundColor(mToolbarColor);
  toolbar.setTitleTextColor(mToolbarWidgetColor);
  final TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
  toolbarTitle.setTextColor(mToolbarWidgetColor);
  toolbarTitle.setText(mToolbarTitle);
  // Color buttons inside the Toolbar
  Drawable stateButtonDrawable = ContextCompat.getDrawable(this, mToolbarCancelDrawable).mutate();
  stateButtonDrawable.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP);
  toolbar.setNavigationIcon(stateButtonDrawable);
  setSupportActionBar(toolbar);
  final ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(false);
  }
}

代码示例来源:origin: liuguangqiang/SwipeBack

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_webview);
  setDragEdge(SwipeBackLayout.DragEdge.TOP);
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle(R.string.title_activity_webview);
  toolbar.setTitleTextColor(Color.WHITE);
  setSupportActionBar(toolbar);
  initViews();
}

代码示例来源:origin: liuguangqiang/SwipeBack

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_list_view);
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle(R.string.title_activity_list_view);
  toolbar.setTitleTextColor(Color.WHITE);
  setSupportActionBar(toolbar);
  initData();
  initView();
  setDragEdge(SwipeBackLayout.DragEdge.LEFT);
}

代码示例来源:origin: scwang90/SmartRefreshLayout

case 默认主题:
  mToolbar.setBackgroundResource(android.R.color.white);
  mToolbar.setTitleTextColor(0xffbbbbbb);
  mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_gray_24dp);
  mRefreshLayout.setPrimaryColors(0xfff0f0f0, 0xffffffff);

代码示例来源:origin: liuguangqiang/SwipeBack

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_common);
    setTitle("Common");
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.WHITE);
    setSupportActionBar(toolbar);
    setDragEdge(SwipeBackLayout.DragEdge.LEFT);
  }
}

代码示例来源:origin: omadahealth/LolliPin

private void initView() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar);
    setSupportActionBar(toolbar);

    toolbar.setTitle("Title");
    toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
    toolbar.setSubtitle("SubTitle");
    toolbar.setSubtitleTextColor(getResources().getColor(android.R.color.white));
    toolbar.setLogo(R.drawable.ic_launcher);
    toolbar.setNavigationIcon(R.drawable.ic_menu_white_36dp);
  }
}

代码示例来源:origin: florent37/MaterialTextField

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Fabric.with(this, new Crashlytics());

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitleTextColor(Color.WHITE);

    final ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
      supportActionBar.setDisplayHomeAsUpEnabled(true);
    }
  }
}

代码示例来源:origin: githubwing/ByeBurger

private void initView() {
 mToolbar = (Toolbar) findViewById(R.id.toolbar);
 mToolbar.setTitleTextColor(Color.WHITE);
 mToolbar.setTitle("Bye! Bye! Burger");
 setSupportActionBar(mToolbar);

代码示例来源:origin: listenzz/AndroidNavigation

@Override
public void setTitleTextColor(int titleTextColor) {
  this.titleTextColor = titleTextColor;
  super.setTitleTextColor(titleTextColor);
  if (titleView != null) {
    titleView.setTextColor(titleTextColor);
  }
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  public void onAnimationCancel(Animator animation) {
    super.onAnimationCancel(animation);
    toolbar.setTitleTextColor(color);
  }
});

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  public void onAnimationUpdate(ValueAnimator valueAnimator) {
    toolbar.setTitleTextColor(getAnimatedColor(transparent, color,
        valueAnimator.getAnimatedFraction()));
  }
});

代码示例来源:origin: dabutaizha/juzimi

@Override
protected void initView() {
  mPresenter.initData();
  setSupportActionBar(mToolbar);
  getSupportActionBar().setTitle(R.string.open_source_title);
  mToolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.colorAccent));
  mToolbar.setNavigationIcon(R.drawable.back);
  mAdapter = new OpenSourceAdapter(new ArrayList<>());
  mRecyclerView.setAdapter(mAdapter);
  mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
}

代码示例来源:origin: TakeoffAndroid/MaterialDialogSearchView

private void toolBarData() {
  toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle("MaterialDialogSearchView");
  toolbar.setTitleTextColor(getResources().getColor(R.color.white));
  setSupportActionBar(toolbar);
}

代码示例来源:origin: geniusgithub/MediaPlayer

private void initToolBar() {
  mToolbar.setTitle("PICTURE");
  mToolbar.setTitleTextColor(Color.parseColor("#ffffff"));
  mToolbar.setBackgroundColor(Color.parseColor("#00ffffff"));
  Activity parentActivity = getActivity();
  if (parentActivity instanceof AppCompatActivity){
    ((AppCompatActivity)parentActivity).setSupportActionBar(mToolbar);
    final ActionBar ab = ((AppCompatActivity)parentActivity).getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);
  }
}

代码示例来源:origin: Nipuream/NRecyclerView

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_init);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

//        toolbar.setLogo(R.mipmap.ic_launcher);
    toolbar.setTitle("InitActivity");
    toolbar.setTitleTextColor(Color.WHITE);
//        toolbar.setSubtitle("Sub title");
    setSupportActionBar(toolbar);
//        toolbar.setNavigationIcon(R.mipmap.ic_launcher);
  }

代码示例来源:origin: dabutaizha/juzimi

@Override
protected void initView() {
  setSupportActionBar(mToolbar);
  getSupportActionBar().setTitle(R.string.app_theme_title);
  mToolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.colorAccent));
  mToolbar.setNavigationIcon(R.drawable.back);
}

代码示例来源:origin: enginebai/SwagPoints

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitle(R.string.title);
    toolbar.setTitleTextColor(Color.WHITE);
  }
}

代码示例来源:origin: pinguo-zhouwei/MaterialDesignSamples

@Override
  public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
    Log.e("zhouwei","appbarHeight:"+appBarLayout.getHeight()+" getTotalScrollRange:"+appBarLayout.getTotalScrollRange()+" offSet:"+verticalOffset);
    if(Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()){
      toolbar.setTitleTextColor(getResources().getColor(R.color.white));
      collapsingToolbarLayout.setTitle("AppbarLayout");
    }else{
      collapsingToolbarLayout.setTitle("");
    }
  }
});

相关文章

Toolbar类方法