本文整理了Java中android.support.v7.widget.Toolbar.getBottom()
方法的一些代码示例,展示了Toolbar.getBottom()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.getBottom()
方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:getBottom
暂无
代码示例来源:origin: florent37/MaterialViewPager
private boolean toolbarJoinsTabs() {
return (mHeader.toolbar.getBottom() == mHeader.mPagerSlidingTabStrip.getTop() + ViewCompat.getTranslationY(mHeader.mPagerSlidingTabStrip));
}
代码示例来源:origin: Rukey7/MvpApp
@Override
public void onPhotoClick() {
mIsHideToolbar = !mIsHideToolbar;
if (mIsHideToolbar) {
mDragLayout.scrollOutScreen(300);
mToolbar.animate().translationY(-mToolbar.getBottom()).setDuration(300);
} else {
mDragLayout.scrollInScreen(300);
mToolbar.animate().translationY(0).setDuration(300);
}
}
});
代码示例来源:origin: Rukey7/MvpApp
@Override
public void onPhotoClick() {
mIsHideToolbar = !mIsHideToolbar;
if (mIsHideToolbar) {
mDragLayout.startOutAnim();
mToolbar.animate().translationY(-mToolbar.getBottom()).setDuration(300);
} else {
mDragLayout.startInAnim();
mToolbar.animate().translationY(0).setDuration(300);
}
}
});
代码示例来源:origin: florent37/MaterialViewPager
/**
* move the toolbarlayout (containing toolbar & tabs)
* following the current scroll
*/
private void followScrollToolbarLayout(float yOffset) {
if (mHeader.toolbar.getBottom() == 0) {
return;
}
if (toolbarJoinsTabs()) {
if (firstScrollValue == Float.MIN_VALUE) {
firstScrollValue = yOffset;
}
float translationY = firstScrollValue - yOffset;
if (translationY > 0) {
translationY = 0;
}
log("translationY " + translationY);
ViewCompat.setTranslationY(mHeader.toolbarLayout, translationY);
} else {
ViewCompat.setTranslationY(mHeader.toolbarLayout, 0);
justToolbarAnimated = false;
}
followScrollToolbarIsVisible = (ViewCompat.getY(mHeader.toolbarLayout) >= 0);
}
代码示例来源:origin: florent37/MaterialViewPager
initialDistance = mHeader.mPagerSlidingTabStrip.getTop() - mHeader.toolbar.getBottom();
float newDistance = ViewCompat.getY(mHeader.mPagerSlidingTabStrip) - mHeader.toolbar.getBottom();
if (ViewCompat.getY(mHeader.mPagerSlidingTabStrip) < mHeader.getToolbar().getBottom()) {
float ty = mHeader.getToolbar().getBottom() - mHeader.mPagerSlidingTabStrip.getTop();
ViewCompat.setTranslationY(mHeader.mPagerSlidingTabStrip, ty);
ViewCompat.setTranslationY(mHeader.toolbarLayoutBackground, ty);
代码示例来源:origin: dongorigin/AndroidDemo
protected void onActionBarAutoShowOrHide(boolean shown) {
Log.d(TAG, "onActionBarAutoShowOrHide " + shown);
if (mStatusBarColorAnimator != null) {
mStatusBarColorAnimator.cancel();
}
if (shown) {
mActionBarToolbar.animate().translationY(0).alpha(1)
.setDuration(HEADER_HIDE_ANIM_DURATION)
.setInterpolator(new DecelerateInterpolator());
} else {
mActionBarToolbar.animate().translationY(-mActionBarToolbar.getBottom()).alpha(0)
.setDuration(HEADER_HIDE_ANIM_DURATION)
.setInterpolator(new DecelerateInterpolator());
}
}
代码示例来源:origin: yoyiyi/bilisoleil
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
//滑动的距离
mDistanceY += dy;
//toolbar的高度
int toolbarHeight = mToolbar.getBottom();
//当滑动的距离 <= toolbar高度的时候,改变Toolbar背景色的透明度,达到渐变的效果
if (mDistanceY <= toolbarHeight) {
float scale = (float) mDistanceY / toolbarHeight;
float alpha = scale * 255;
mToolbar.setBackgroundColor(Color.argb((int) alpha, 251, 114, 153));
} else {
//上述虽然判断了滑动距离与toolbar高度相等的情况,但是实际测试时发现,标题栏的背景色
//很少能达到完全不透明的情况,所以这里又判断了滑动距离大于toolbar高度的情况,
//将标题栏的颜色设置为完全不透明状态
mToolbar.setBackgroundResource(R.color.colorPrimary);
}
}
});
代码示例来源: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);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!