Alv*_*ere 13 java android material-design google-inbox
目前,我正在尝试像行为一样实施谷歌收件箱RecyclerView,我对电子邮件开放动画非常好奇.
我的问题是:怎么做?我的意思是,他们使用哪种方法?他们是否使用ItemAnimator.dispatchChangeStarting()并改变它的高度来填充父母?还是别的什么?如果他们这样做,他们如何使用拉动手势使其接近,而底层RecyclerView元素稍微可见.
任何人都可以帮助我指向一些库,或代码片段/示例?
您的意思是:回收器视图作为加载项目,或者一次项目并按下加载下一个屏幕。
我留下了一个如何在 recyclerview 中对项目进行收费的示例,并给出了一个动画
public class CreateAnimationView {
private static int contador;
Integer colorFrom = R.color.myAccentColor;
Integer colorTo = Color.RED;
public static AnimatorSet createAnimation(View view) {
ObjectAnimator fadeOut = ObjectAnimator.ofFloat(view, "alpha",
0f);
fadeOut.setDuration(300);
ObjectAnimator mover = ObjectAnimator.ofFloat(view,
"translationX", -500f, 0f);
mover.setDuration(400);
ObjectAnimator fadeIn = ObjectAnimator.ofFloat(view, "alpha",
0f, 1f);
fadeIn.setDuration(300);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(mover);
animatorSet.start();
return animatorSet;
}
... more animations methods.
}
Run Code Online (Sandbox Code Playgroud)
在您的 RecyclerViewAdapter 中:
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {
GruposCardView gruposCardView = gruposCardViews.get(position);
CreateAnimationView.createAnimationRandom(viewHolder.cardView);
...}
Run Code Online (Sandbox Code Playgroud)
如果不在回收器视图中,您可以传递一个布局并使用此动画或从中创建一个。
public static AnimatorSet createAnimationCollapseXY(View view) {
ObjectAnimator scaleXOut = ObjectAnimator.ofFloat(view, "scaleX", 1f, 0f).setDuration(400);
ObjectAnimator scaleXIn = ObjectAnimator.ofFloat(view, "scaleX", 0f, 1f).setDuration(300);
ObjectAnimator scaleYOut = ObjectAnimator.ofFloat(view, "scaleY", 1f, 0f).setDuration(400);
ObjectAnimator scaleYIn = ObjectAnimator.ofFloat(view, "scaleY", 0f, 1f).setDuration(300);
ObjectAnimator rotateClockWise = ObjectAnimator.ofFloat(view, "rotation", 0f, 360f).setDuration(400);
ObjectAnimator rotateCounterClockWise = ObjectAnimator.ofFloat(view, "rotation", 0f, -360f).setDuration(400);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(scaleXIn, scaleYIn);
//animatorSet.setStartDelay(1200);
animatorSet.start();
return animatorSet;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2046 次 |
| 最近记录: |