本文整理汇总了Java中android.support.design.widget.CollapsingToolbarLayout.setContentScrimColor方法的典型用法代码示例。如果您正苦于以下问题:Java CollapsingToolbarLayout.setContentScrimColor方法的具体用法?Java CollapsingToolbarLayout.setContentScrimColor怎么用?Java CollapsingToolbarLayout.setContentScrimColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.CollapsingToolbarLayout
的用法示例。
在下文中一共展示了CollapsingToolbarLayout.setContentScrimColor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageAnimator
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
ImageAnimator(CollapsingToolbarLayout collapsingToolbar, ImageView targetImage, ImageView outgoingImage) {
this.collapsingToolbar = collapsingToolbar;
mTargetImage = targetImage;
mOutgoingImage = outgoingImage;
BindingUtils.loadImg(mTargetImage, mImages[0]);
Resources mResources = App.getAppContext().getResources();
int[] mColorDay = mResources.getIntArray(R.array.day_color_tab);
int[] mColorNight = mResources.getIntArray(R.array.night_color_tab);
mColors = SpUtil.isNight() ? mColorNight : mColorDay;
collapsingToolbar.setContentScrimColor(mColors[0]);
collapsingToolbar.setStatusBarScrimColor(mColors[0]);
}
示例2: setCustomTheme
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
void setCustomTheme(
int color,
int colorDark,
CollapsingToolbarLayout collapsingToolbarLayout) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
collapsingToolbarLayout.setContentScrimColor(color);
collapsingToolbarLayout.setBackgroundColor(color);
this.getWindow().setNavigationBarColor(color);
this.getWindow().setStatusBarColor(colorDark);
}
}
示例3: updateToolbarColors
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
private void updateToolbarColors() {
if (toolbar == null || toggle == null) {
return;
}
int[] colors = ColorUtils.get2ToolbarTextColors(this);
int mainTC = colors[0];
toolbar.setTitleTextColor(mainTC);
toggle.getDrawerArrowDrawable().setColor(mainTC);
if (menu != null) {
MenuItem search = menu.findItem(R.id.action_main_search);
if (search != null) {
Drawable icon = search.getIcon();
if (icon != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
icon.setTint(mainTC);
}
}
}
}
CollapsingToolbarLayout coll = (CollapsingToolbarLayout) findViewById(R.id.activity_main_coll_tool_bar);
int[] cs = ColorUtils.get2ActionStatusBarColors(this);
coll.setStatusBarScrimColor(cs[0]);
coll.setContentScrimColor(cs[1]);
toolbar.setBackgroundColor(cs[1]);
// 为了使状态栏透明,不要设置颜色
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// getWindow().setStatusBarColor(cs[0]);
}
}
示例4: setToolbar
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
public void setToolbar() {
CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout)findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setContentScrimColor(ContextCompat.getColor(this, R.color.colorPrimary));
collapsingToolbar.setTitle(getString(R.string.movie_details));
collapsingToolbar.setCollapsedTitleTextAppearance(R.style.CollapsedToolbar);
collapsingToolbar.setExpandedTitleTextAppearance(R.style.ExpandedToolbar);
collapsingToolbar.setTitleEnabled(true);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
示例5: themeChange
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
public void themeChange(ThemeEnum themeEnum, int[] colors) {
ThemeEnum th = appPreference.getTheme();
int[] cs = ColorUtils.get10ThemeColors(this, th);
int statusC = cs[0];
int toolbarC = cs[1];
int accentC = cs[2];
int mainBC = cs[3];
int vicBC = cs[4];
int mainTC = cs[5];
int vicTC = cs[6];
int navC = cs[7];
int toolbarMainTC = cs[8];
int toolbarVicTC = cs[9];
adapter.themeChange(th, cs);
optionsDialog.setTitleBarBgColor(vicBC);
optionsDialog.setContentBgColor(mainBC);
optionsDialog.setDivideColor(vicTC);
optionsDialog.setTitleTextColor(mainTC);
optionsAdapter.setTitleColor(mainTC);
optionsAdapter.setIconColor(accentC);
FirstThreeViewHolder[] holders = {first, second, third};
for (FirstThreeViewHolder holder : holders) {
holder.number.setTextColor(mainBC);
holder.name.setTextColor(mainTC);
holder.arts.setTextColor(vicTC);
holder.time.setTextColor(toolbarMainTC);
holder.time.setBackgroundColor(accentC);
}
line.setBackgroundColor(accentC);
title.setTextColor(mainTC);
CollapsingToolbarLayout coll = (CollapsingToolbarLayout) findViewById(R.id.rmp_a_coll_toolbar);
int[] ta = ColorUtils.get2ActionStatusBarColors(this);
coll.setStatusBarScrimColor(ta[0]);
coll.setContentScrimColor(ta[1]);
toolbar.setBackgroundColor(ta[1]);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(ta[0]);
}
}
示例6: onServiceConnected
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
public void onServiceConnected(ComponentName className,
IBinder service) {
// We've bound to LocalService, cast the IBinder and get LocalService instance
binder = (MainService.LocalBinder) service;
mainService = binder.getService();
locBound = true;
Network net = mainService.getNetwork(networkId);
Line line = net.getLine(lineId);
String title = String.format(getString(R.string.act_line_title), line.getName());
setTitle(title);
getSupportActionBar().setTitle(title);
AppBarLayout abl = (AppBarLayout) findViewById(R.id.app_bar);
final CollapsingToolbarLayout ctl = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
ctl.setTitle(title);
int color = line.getColor();
ctl.setContentScrimColor(color);
ctl.setStatusBarScrimColor(color);
abl.setBackgroundColor(color);
Drawable drawable = ContextCompat.getDrawable(LineActivity.this, Util.getDrawableResourceIdForLineId(line.getId()));
drawable.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 35, getResources().getDisplayMetrics());
FrameLayout iconFrame = new FrameLayout(LineActivity.this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(height, height);
int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
params.setMarginEnd(margin);
}
params.setMargins(0, 0, margin, 0);
iconFrame.setLayoutParams(params);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
iconFrame.setBackgroundDrawable(drawable);
} else {
iconFrame.setBackground(drawable);
}
lineIconsLayout.addView(iconFrame);
abl.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (ctl.getHeight() + verticalOffset < 2.5 * ViewCompat.getMinimumHeight(ctl)) {
lineIconsLayout.animate().alpha(0);
} else {
lineIconsLayout.animate().alpha(1);
}
}
});
Map<String, LineStatusCache.Status> statuses = mainService.getLineStatusCache().getLineStatus();
if (statuses.get(line.getId()) != null &&
statuses.get(line.getId()).down) {
disturbancesWarningLayout.setVisibility(View.VISIBLE);
} else {
disturbancesWarningLayout.setVisibility(View.GONE);
}
LinearLayout closedLayout = (LinearLayout) findViewById(R.id.closed_info_layout);
if (line.isExceptionallyClosed(new Date())) {
TextView closedView = (TextView) findViewById(R.id.closed_info_view);
Formatter f = new Formatter();
DateUtils.formatDateRange(LineActivity.this, f, line.getNextOpenTime(), line.getNextOpenTime(), DateUtils.FORMAT_SHOW_TIME, Time.TIMEZONE_UTC);
closedView.setText(String.format(getString(R.string.act_line_closed_schedule), f.toString()));
closedLayout.setVisibility(View.VISIBLE);
} else {
closedLayout.setVisibility(View.GONE);
}
populateLineView(LineActivity.this, getLayoutInflater(), net, line, lineLayout);
}