本文整理了Java中android.support.v7.widget.Toolbar.getHeight()
方法的一些代码示例,展示了Toolbar.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.getHeight()
方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:getHeight
暂无
代码示例来源:origin: scwang90/SmartRefreshLayout
@Override
public void onHeaderMoving(RefreshHeader header, boolean isDragging, float percent, int offset, int headerHeight, int maxDragHeight) {
toolbar.setAlpha(1 - Math.min(percent, 1));
floor.setTranslationY(Math.min(offset - floor.getHeight() + toolbar.getHeight(), refreshLayout.getLayout().getHeight() - floor.getHeight()));
}
// @Override
代码示例来源:origin: scwang90/SmartRefreshLayout
@Override
public void run() {
refreshLayout.setHeaderInsetStart(DensityUtil.px2dp(toolbar.getHeight()));
}
}, 500);
代码示例来源:origin: xinghongfei/LookLook
protected void hideOrShowToolbar() {
mToolbar.animate()
.translationY(mIsHidden ? 0 : -mToolbar.getHeight())
.setInterpolator(new DecelerateInterpolator(2))
.start();
mIsHidden = !mIsHidden;
}
代码示例来源:origin: xinghongfei/LookLook
private void enterAnimation() {
float offSet = mToolbar.getHeight();
LinearInterpolator interpolator = new LinearInterpolator();
AccelerateInterpolator accelerateInterpolator = new AccelerateInterpolator();
viewEnterAnimation(mToolbar, offSet, interpolator);
viewEnterAnimationNest(mNest, 0f, accelerateInterpolator);
}
代码示例来源:origin: smuyyh/BookReader
private void toolbarAnimateHide() {
if (mIsActionBarVisible) {
mCommonToolbar.animate()
.translationY(-mCommonToolbar.getHeight())
.setInterpolator(new LinearInterpolator())
.setDuration(180)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
toolbarSetElevation(0);
hideStatusBar();
if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
mTocListPopupWindow.dismiss();
}
}
});
mIsActionBarVisible = false;
}
}
代码示例来源:origin: xinghongfei/LookLook
private void enterAnimation() {
float offSet = mToolbar.getHeight();
LinearInterpolator interpolator=new LinearInterpolator();
viewEnterAnimation(mShot, offSet, interpolator);
viewEnterAnimationNest(mNest,0f,interpolator);
}
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
int visibility = View.VISIBLE;
// 如果是AppbarLayout滑动到了最顶端,要把这个divider隐藏掉
if (getTablayout().getHeight() + toolbar.getHeight() - appBarLayout.getHeight() == verticalOffset) {
visibility = View.GONE;
}
if (layHeaderDivider.getVisibility() != visibility)
layHeaderDivider.setVisibility(visibility);
}
代码示例来源:origin: wangdan/AisenWeiBo
float toAvatartTop = maxVerticalOffset + statusbarHeight + (toolbar.getHeight() - finalAvatarSize) * 1.0f / 2;
float avatarTop = startAvatarTop - (startAvatarTop - toAvatartTop) * factor;
float toNameTop = maxVerticalOffset + statusbarHeight + (toolbar.getHeight() - finalLayNameSize) * 1.0f / 2;
float nameTop = startNameTop - (startNameTop - toNameTop) * factor;
代码示例来源:origin: florent37/MaterialViewPager
@Override
public boolean onPreDraw() {
//rotation fix, if not set, originalTitleY = Na
ViewCompat.setTranslationY(mLogo,0);
ViewCompat.setTranslationX(mLogo, 0);
originalTitleY = ViewCompat.getY(mLogo);
originalTitleX = ViewCompat.getX(mLogo);
originalTitleHeight = mLogo.getHeight();
finalTitleHeight = dpToPx(21, context);
//the final scale of the logo
finalScale = finalTitleHeight / originalTitleHeight;
finalTitleY = (toolbar.getPaddingTop() + toolbar.getHeight()) / 2 - finalTitleHeight / 2 - (1 - finalScale) * finalTitleHeight;
//(mLogo.getWidth()/2) *(1-finalScale) is the margin left added by the scale() on the logo
//when logo scaledown, the content stay in center, so we have to anually remove the left padding
finalTitleX = dpToPx(52f, context) - (mLogo.getWidth() / 2) * (1 - finalScale);
toolbarLayout.getViewTreeObserver().removeOnPreDrawListener(this);
return false;
}
});
代码示例来源:origin: wangdan/AisenWeiBo
maxVerticalOffset = appBarLayout.getHeight() - (statusbarHeight + toolbar.getHeight() + tabLayout.getHeight()) - 2;
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
maxVerticalOffset = appBarLayout.getHeight() - (statusbarHeight + toolbar.getHeight() + tabLayout.getHeight()) - 2 - statusbarHeight;
代码示例来源:origin: wangdan/AisenWeiBo
if (avatarSize == 0 && toolbar.getHeight() > 0) {
int defHeight = layDetail.getHeight();
CollapsingToolbarLayout.LayoutParams lp = (CollapsingToolbarLayout.LayoutParams) imgCover.getLayoutParams();
int maxOffset = appBarLayout.getHeight() - (getStatusBarHeight() + toolbar.getHeight() + tabLayout.getHeight());
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
@Override
public void onTransitionStart(@NonNull Transition transition) {
//hide toolbar & statusbar
float toolbar_translationY = -(toolbar.getHeight());
float bottomBar_translationY = ((View) bottomBar.getParent()).getHeight();
toolbar.setTranslationY(toolbar_translationY);
((View) bottomBar.getParent()).setTranslationY(bottomBar_translationY);
super.onTransitionStart(transition);
}
代码示例来源:origin: r17171709/android_demo
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (!isChangeHeight) {
//为toolbar预留空间
CoordinatorLayout.LayoutParams params= (CoordinatorLayout.LayoutParams) design_bottom_sheet.getLayoutParams();
params.height=design_coor.getHeight()-design_toolbar.getHeight();
design_bottom_sheet.setLayoutParams(params);
beginHeight=design_toolbar.getHeight()*2;
isChangeHeight=true;
}
}
}
代码示例来源:origin: GitLqr/MaterialDesignDemo
@Override
public void hide() {
mToolbar.animate().translationY(-(mToolbar.getHeight() + mToolbarBottomMargin)).setInterpolator(new AccelerateInterpolator(3));
mFab.animate().translationY(mFab.getHeight() + mFabBottomMargin).setInterpolator(new AccelerateInterpolator(3));
}
代码示例来源:origin: kymjs/Modularity
/**
* 显示Toolbar的退出tip
*/
public void showExitTip() {
TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
view.setVisibility(View.VISIBLE);
Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, -getToolbar().getHeight(), 0f, 300);
view.startAnimation(a);
}
代码示例来源:origin: kymjs/Modularity
/**
* 显示Toolbar的退出tip
*/
public void showExitTip() {
TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
view.setVisibility(View.VISIBLE);
Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, -getToolbar().getHeight(), 0f, 300);
view.startAnimation(a);
}
代码示例来源:origin: kymjs/Modularity
/**
* 显示Toolbar的退出tip
*/
public void showExitTip() {
TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
view.setVisibility(View.VISIBLE);
Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, -getToolbar().getHeight(), 0f, 300);
view.startAnimation(a);
}
代码示例来源:origin: kollerlukas/Camera-Roll-Android-App
@Override
public void onGlobalLayout() {
imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
imageView.setPadding(imageView.getPaddingStart(),
imageView.getPaddingTop() + toolbar.getHeight(),
imageView.getPaddingEnd(),
imageView.getPaddingBottom() + actionArea.getHeight());
}
});
代码示例来源:origin: powerpoint45/Lucid-Browser
public void showOrHide(){
if (!locked){
Float curY = activity.webLayout.getY();
if (curY<(activity.toolbar.getHeight()+Tools.getStatusSize(activity))/2){
hide();
}
else
show();
}
}
代码示例来源:origin: ywwynm/EverythingDone
private void updateFabState() {
int statusbarSize = DeviceUtil.hasKitKatApi() ?
DisplayUtil.getStatusbarHeight(StatisticActivity.this) : 0;
int scrollY = mScrollView.getScrollY();
int actionbarSize = mActionbar.getHeight();
float fabY = mHeaderHeight - statusbarSize - actionbarSize - actionbarSize;
if (scrollY >= fabY) {
mFab.shrink();
} else {
mFab.spread();
}
}
内容来源于网络,如有侵权,请联系作者删除!