iielse / learn-coordinatorlayout-behavior Goto Github PK
View Code? Open in Web Editor NEWCoordinatorLayout 自定义Behavior 高仿美团商家详情界面 实现页面内容复杂联动效果
CoordinatorLayout 自定义Behavior 高仿美团商家详情界面 实现页面内容复杂联动效果
// val effect = adInterpolator.getInterpolation(offset / offsetMax)
// val e: Int = argbEvaluator.evaluate(effect, Color.WHITE, 0xFF646464.toInt()) as Int
// vSearch.setImageDrawable(tintDrawable(drawableSearch, ColorStateList.valueOf(e)))
// vSearch.scaleX = (1 - 0.4 * effect).toFloat()
// vSearch.scaleY = (1 - 0.4 * effect).toFloat()
// vSearch.translationX = -(vSearchBorder.width - vSearch.width + dp(3)) * effect
// vSearchHint.alpha = effect
// vSearchHint.translationX = (vSearchHint.width / 3) * (1 - effect)
if (dy>0&&offset==offsetMax){
return 1F;
}else if (dy<0&&offset==0F){
return 0F;
}
offset+=dy;
if (offset>offsetMax){
offset=offsetMax;
}else if (offset<0){
offset=0F;
}
float effect = adInterpolator.getInterpolation(offset / offsetMax);
int e = (int) argbEvaluator.evaluate(effect,Color.WHITE,Color.parseColor("#999999"));
float kotlinturnjava (int dy){
if (dy>0&&offset==offsetMax){
return 1F;
}else if (dy<0&&offset==0F){
return 0F;
}
offset+=dy;
if (offset>offsetMax){
offset=offsetMax;
}else if (offset<0){
offset=0F;
}
float effect = adInterpolator.getInterpolation(offset / offsetMax);
int e = (int) argbEvaluator.evaluate(effect,Color.WHITE,Color.parseColor("#999999"));
sousuo_img.setImageDrawable(tintDrawable(getResources().getDrawable(R.mipmap.xin_khsousuo),ColorStateList.valueOf(e)));
sousuo_img.setScaleX(Float.parseFloat(String.valueOf(1 - 0.4 * effect)));
sousuo_img.setScaleY(Float.parseFloat(String.valueOf(1 - 0.4 * effect)));
hidesousuolay.setAlpha(effect);
hidesousuolay.setTranslationX(hidesousuolay.getWidth()-hidesousuolay.getWidth()+ DensityUtils.dip2px(NewUseShopActivity.this,3)*effect);
return effect;
}
这个没翻译:
if ((child.translationY < 0 || (child.translationY == 0F && dy > 0)) && !child.canScrollVertically()) {
val effect = layTitle.effectByOffset(dy)
selfView.vSmartTab.setBackgroundColor(argbEvaluator.evaluate(effect, Color.WHITE, 0xFFFAFAFA.toInt()) as Int)
val transY = -simpleTopDistance * effect
if (transY != child.translationY) {
child.translationY = transY
consumed[1] = dy
}
if (type == 1) {
isScrollToFullFood = true
}
} else if ((child.translationY > 0 || (child.translationY == 0F && dy < 0)) && !child.canScrollVertically()) {
if (isScrollToFullFood) {
child.translationY = 0F // top fling to bottom顶到底
} else {
child.translationY -= dy
layContent.effectByOffset(child.translationY)
laySettle.effectByOffset(child.translationY)
}
consumed[1] = dy
}
这段怎么用看不懂啊???求解
向下滑动,点菜、评论、商家直接移动到了最下方;默认收缩起来的区域直接变到最大,没有滑动的过程
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.