本文整理了Java中android.support.v7.widget.Toolbar.setElevation()
方法的一些代码示例,展示了Toolbar.setElevation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setElevation()
方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:setElevation
暂无
代码示例来源:origin: smuyyh/BookReader
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void toolbarSetElevation(float elevation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mCommonToolbar.setElevation(elevation);
}
}
代码示例来源:origin: smuyyh/BookReader
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void toolbarSetElevation(float elevation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mCommonToolbar.setElevation(elevation);
}
}
代码示例来源:origin: xinghongfei/LookLook
@Override
public void onTransitionStart(Transition transition) {
super.onTransitionStart(transition);
// hide the fab as for some reason it jumps position?? TODO work out why
mToolbar.animate()
.alpha(0f)
.setDuration(100)
.setInterpolator(new AccelerateInterpolator());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mShot.setElevation(1f);
mToolbar.setElevation(0f);
}
mNest.animate()
.alpha(0f)
.setDuration(50)
.setInterpolator(new AccelerateInterpolator());
}
};
代码示例来源:origin: xinghongfei/LookLook
@Override
public void onTransitionStart(Transition transition) {
super.onTransitionStart(transition);
// hide the fab as for some reason it jumps position?? TODO work out why
mToolbar.animate()
.alpha(0f)
.setDuration(100)
.setInterpolator(new AccelerateInterpolator());
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
mShot.setElevation(1f);
mToolbar.setElevation(0f);
}
mNest.animate()
.alpha(0f)
.setDuration(50)
.setInterpolator(new AccelerateInterpolator());
}
};
代码示例来源:origin: iSoron/uhabits
protected void initToolbar()
{
if (SDK_INT >= LOLLIPOP)
{
getToolbar().setElevation(InterfaceUtils.dpToPixels(context, 2));
View view = findViewById(R.id.toolbarShadow);
if (view != null) view.setVisibility(GONE);
view = findViewById(R.id.headerShadow);
if (view != null) view.setVisibility(GONE);
}
}
代码示例来源:origin: iSoron/uhabits
@Deprecated
public static void setupActionBarColor(@NonNull AppCompatActivity activity,
int color)
{
Toolbar toolbar = (Toolbar) activity.findViewById(R.id.toolbar);
if (toolbar == null) return;
activity.setSupportActionBar(toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar == null) return;
actionBar.setDisplayHomeAsUpEnabled(true);
ColorDrawable drawable = new ColorDrawable(color);
actionBar.setBackgroundDrawable(drawable);
if (SDK_INT >= LOLLIPOP)
{
int darkerColor = ColorUtils.mixColors(color, Color.BLACK, 0.75f);
activity.getWindow().setStatusBarColor(darkerColor);
toolbar.setElevation(InterfaceUtils.dpToPixels(activity, 2));
View view = activity.findViewById(R.id.toolbarShadow);
if (view != null) view.setVisibility(View.GONE);
view = activity.findViewById(R.id.headerShadow);
if (view != null) view.setVisibility(View.GONE);
}
}
代码示例来源:origin: SmartDengg/SmartDrawing
private void bindToolbar() {
BaseActivity.this.setSupportActionBar(toolbar);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) toolbar.setElevation(0.0f);
BaseActivity.this.setupToolBar();
}
代码示例来源:origin: code-troopers/material-android-bootstrap
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutResource());
ButterKnife.bind(this);
Icepick.restoreInstanceState(this, savedInstanceState);
if (mToolbar != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mToolbar.setElevation(getResources().getDimensionPixelSize(R.dimen.action_bar_elevation));
}
setSupportActionBar(mToolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
}
代码示例来源:origin: apptentive/apptentive-android
@TargetApi(21)
private void showToolbarElevationLollipop(boolean visible) {
if (!isAdded()) {
return;
}
if (toolbar != null) {
if (visible) {
toolbar.setElevation(Util.dipsToPixels(getContext(), 4.0F));
} else {
toolbar.setElevation(0.0F);
}
} else {
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
if (visible) {
actionBar.setElevation(Util.dipsToPixels(getContext(), 4.0F));
} else {
actionBar.setElevation(0.0F);
}
}
}
}
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
toolbar.setElevation(context.getResources()
.getDimension(R.dimen.toolbar_elevation));
内容来源于网络,如有侵权,请联系作者删除!