栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Google Inbox之类的RecyclerView项目打开动画

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Google Inbox之类的RecyclerView项目打开动画

您的意思是:将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.}

在您的RecyclerViewAdapter中:

@Overridepublic void onBindViewHolder(ViewHolder viewHolder, int position) {    GruposCardView gruposCardView = gruposCardViews.get(position);    CreateAnimationView.createAnimationRandom(viewHolder.cardView);   ...}

如果不在recyclerview中,则可以传递布局并使用此动画或从中创建一个动画。

 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;}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/455560.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号