本文整理了Java中androidx.appcompat.widget.Toolbar.setBackgroundColor()
方法的一些代码示例,展示了Toolbar.setBackgroundColor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setBackgroundColor()
方法的具体详情如下:
包路径:androidx.appcompat.widget.Toolbar
类名称:Toolbar
方法名:setBackgroundColor
暂无
代码示例来源:origin: mikepenz/MaterialDrawer
toolbar.setBackgroundColor(Color.BLACK);
toolbar.getBackground().setAlpha(90);
getSupportActionBar().setTitle(R.string.drawer_item_fullscreen_drawer);
代码示例来源:origin: klinker24/Android-DragDismissActivity
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
toolbar.setBackgroundColor((Integer)valueAnimator.getAnimatedValue());
statusBar.setBackgroundColor((Integer)valueAnimator.getAnimatedValue());
}
});
代码示例来源:origin: schaal/ocreader
@Keep
void setStatusBarColor(final int backgroundColor) {
binding.toolbarLayout.toolbar.setBackgroundColor(backgroundColor);
}
}
代码示例来源:origin: cemrich/zapp
private void setColor(int color) {
progressView.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
toolbar.setBackgroundColor(color);
int colorDarker = ColorHelper.darker(color, 0.075f);
window.setStatusBarColor(colorDarker);
int colorAlpha = ColorHelper.darker(ColorHelper.withAlpha(color, 150), 0.25f);
mControlsView.setBackgroundColor(colorAlpha);
}
}
代码示例来源:origin: skydoves/ColorPickerPreference
/** set toolbar color from DefaultSharedPreferences(PreferenceScreen) */
public void setToolbarColor() {
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setBackgroundColor(
sharedPreferences.getInt(
getString(R.string.ToolbarColorPickerPreference),
ContextCompat.getColor(getBaseContext(), R.color.colorPrimary)));
}
代码示例来源:origin: klinker24/Android-DragDismissActivity
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RecyclerView recyclerView = (RecyclerView) activity.findViewById(R.id.dragdismiss_recycler);
if (shouldScrollToolbar() && shouldShowToolbar()) {
recyclerView.addOnScrollListener(new ToolbarScrollListener(getToolbar(), getStatusBar(), getPrimaryColor()));
} else {
getToolbar().setBackgroundColor(getPrimaryColor());
getStatusBar().setBackgroundColor(getPrimaryColor());
}
ColorUtils.changeRecyclerOverscrollColors(recyclerView, getPrimaryColor());
callback.setupRecyclerView(recyclerView);
}
代码示例来源:origin: klinker24/Android-DragDismissActivity
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (shouldScrollToolbar() && shouldShowToolbar()) {
final ToolbarScrollListener scrollListener = new ToolbarScrollListener(getToolbar(), getStatusBar(), getPrimaryColor());
final NestedScrollView scrollView = (NestedScrollView) activity.findViewById(R.id.dragdismiss_scroll_view);
scrollView.setOnScrollChangeListener(scrollListener);
ElasticDragDismissFrameLayout dragDismissLayout = (ElasticDragDismissFrameLayout)
activity.findViewById(R.id.dragdismiss_drag_dismiss_layout);
dragDismissLayout.addListener(new ElasticDragDismissFrameLayout.ElasticDragDismissCallback() {
@Override
public void onDrag(float elasticOffset, float elasticOffsetPixels, float rawOffset, float rawOffsetPixels) {
if (elasticOffsetPixels > 10) {
scrollListener.onScrollChange(scrollView, 0, 0, 0, 1000);
}
}
});
} else {
getToolbar().setBackgroundColor(getPrimaryColor());
getStatusBar().setBackgroundColor(getPrimaryColor());
}
FrameLayout elasticContent = (FrameLayout) activity.findViewById(R.id.dragdismiss_content);
elasticContent.addView(callback.onCreateContent(activity.getLayoutInflater(), elasticContent, savedInstanceState));
if (!drawUnderStatusBar) {
((NestedScrollView.LayoutParams) elasticContent.getLayoutParams()).topMargin = StatusBarHelper.getStatusBarHeight(activity);
}
}
代码示例来源:origin: cbeyls/fosdem-companion-android
ThemeUtils.setStatusBarTrackColor(this, track.getType());
final int trackColor = ContextCompat.getColor(this, track.getType().getColorResId());
toolbar.setBackgroundColor(trackColor);
内容来源于网络,如有侵权,请联系作者删除!