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

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

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

Toolbar.setBackgroundDrawable介绍

暂无

代码示例

代码示例来源:origin: aa112901/remusic

@Override
public void setBackgroundDrawable(Drawable background) {
  super.setBackgroundDrawable(background);
  if (mBackgroundHelper != null) {
    mBackgroundHelper.setBackgroundDrawableExternal(background);
  }
}

代码示例来源:origin: qiujuer/Genius-Android

private void initToolbar() {
  // ToolBar
  RipAnimDrawable ripAnim = new RipAnimDrawable();
  ripAnim.setColor(getResources().getColor(R.color.cyan_600));
  ripAnim.setFluCount(0, 0, 0, 36);
  Toolbar toolbar = (Toolbar) findViewById(R.id.title);
  toolbar.setBackgroundDrawable(ripAnim);
  toolbar.setTitle(getTitle());
  toolbar.inflateMenu(R.menu.menu_main);
  toolbar.setOnMenuItemClickListener(this);
}

代码示例来源:origin: GrenderG/Color-O-Matic

void updateToolbar(int oldColor, int newColor) {
  final TransitionDrawable transition = new TransitionDrawable(new ColorDrawable[]{
      new ColorDrawable(oldColor), new ColorDrawable(newColor)
  });
  if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    toolbar.setBackground(transition);
  } else {
    toolbar.setBackgroundDrawable(transition);
  }
  transition.startTransition(300);
}

代码示例来源:origin: Kunzisoft/AndroidClearChroma

private void updateToolbarAndStatusBar(int newColor) {
  if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    toolbar.setBackground(new ColorDrawable(newColor));
  }
  else {
    toolbar.setBackgroundDrawable(new ColorDrawable(newColor));
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().setStatusBarColor(darkenColor(newColor));
  }
}

相关文章

Toolbar类方法