本文整理了Java中android.support.v7.widget.Toolbar.setBackgroundResource()
方法的一些代码示例,展示了Toolbar.setBackgroundResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setBackgroundResource()
方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:setBackgroundResource
暂无
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: aa112901/remusic
@Override
public void setBackgroundResource(int resId) {
if (mBackgroundHelper != null) {
mBackgroundHelper.setBackgroundResId(resId);
} else {
super.setBackgroundResource(resId);
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
mDrawableProgress.setTint(0xffffffff);
} else if (mDrawableProgress instanceof VectorDrawableCompat) {
((VectorDrawableCompat) mDrawableProgress).setTint(0xffffffff);
}
}
代码示例来源: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: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mAppBarLayout.setBackgroundResource(colorPrimary);
mToolbarLayout.setContentScrimResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
mActionButton.setBackgroundColor(ContextCompat.getColor(this, colorPrimaryDark));
mActionButton.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this, colorPrimaryDark)));
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
private void setThemeColor(int colorPrimary, int colorPrimaryDark) {
mToolbar.setBackgroundResource(colorPrimary);
mAppBarLayout.setBackgroundResource(colorPrimary);
mToolbarLayout.setContentScrimResource(colorPrimary);
mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white);
mActionButton.setBackgroundColor(ContextCompat.getColor(this, colorPrimaryDark));
mActionButton.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(this, colorPrimaryDark)));
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark));
}
}
代码示例来源:origin: bingoogolapple/BGASwipeBackLayout-Android
private void initToolbar() {
mToolbar.setBackgroundResource(android.R.color.transparent);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Test Translucent StatusBar");
}
代码示例来源:origin: scwang90/SmartRefreshLayout
switch (Item.values()[position % Item.values().length]) {
case 默认主题:
mToolbar.setBackgroundResource(android.R.color.white);
mToolbar.setTitleTextColor(0xffbbbbbb);
mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_gray_24dp);
代码示例来源:origin: wutongke/AndroidSkinAnimator
@Override
public void setBackgroundResource(@DrawableRes int resId) {
super.setBackgroundResource(resId);
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.onSetBackgroundResource(resId);
}
}
代码示例来源:origin: kinecosystem/kin-ecosystem-android-sdk
public void setToolbarColor(@ColorRes int colorRes) {
stopToolbarColorAnim();
topToolBar.setBackgroundResource(colorRes);
}
代码示例来源:origin: HotBitmapGG/MoeQuest
@Override
public void initToolBar() {
mToolBar.setTitle(title);
setSupportActionBar(mToolBar);
ActionBar supportActionBar = getSupportActionBar();
mToolBar.setNavigationOnClickListener(v -> onBackPressed());
if (supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
mAppBarLayout.setAlpha(0.5f);
mToolBar.setBackgroundResource(R.color.black_90);
mAppBarLayout.setBackgroundResource(R.color.black_90);
}
代码示例来源:origin: laotan7237/EasyReader
@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);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!