zoukankan      html  css  js  c++  java
  • 顶部提示 先下移出来 再上移出去

    int sw = DisplayUtils.getScreenWidth(mContext);
    int h = DisplayUtils.dipToPx(mContext, 40);


    if (animator == null) {
    animator = android.animation.ValueAnimator.ofFloat(100f, 0f, 0f, 0f, 0f, 0f, 0f, 100f);
    animator.setDuration(1300);
    animator.setInterpolator(new LinearInterpolator());
    animator.addListener(new Animator.AnimatorListener() {
    @Override
    public void onAnimationStart(Animator animation) {

    }

    @Override
    public void onAnimationEnd(Animator animation) {
    ViewUtils.setVisibility(mTvUpdateNotice, View.GONE);
    }

    @Override
    public void onAnimationCancel(Animator animation) {
    ViewUtils.setVisibility(mTvUpdateNotice, View.GONE);
    }

    @Override
    public void onAnimationRepeat(Animator animation) {

    }
    });
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
    float value = (Float) animation.getAnimatedValue();
    float x = value / 100;

    LogUtils.e("long", "value = " + value + " , x = " + x);

    LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) mTvUpdateNotice.getLayoutParams();
    p.topMargin = (int) (-1 * h * x);
    p.width = (int) (sw * ( 1 - x));
    mTvUpdateNotice.setLayoutParams(p);
    mTvUpdateNotice.setAlpha((int) (1 - x));

                LogUtils.e("long", "topMargin = " + p.topMargin + ", width = " + p.width);

    // mTvUpdateNotice.requestLayout();
    }
    });

    }
    animator.start();
  • 相关阅读:
    洛谷 P3366 【模板】最小生成树
    洛谷 P2820 局域网
    一本通【例4-10】最优布线问题
    洛谷 P1546 最短网络 Agri-Net
    图论模板
    洛谷 AT667 【天下一人力比較】
    刷题记录
    洛谷P1553 数字翻转(升级版)
    tornado硬件管理系统-网络与磁盘的实现(7)
    tornado硬件管理系统-内存与swap的实现(6)
  • 原文地址:https://www.cnblogs.com/wutianlong/p/9888438.html
Copyright © 2011-2022 走看看