CommitmentsFragment.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:commit-android 作者:
public static void expand(final View v) {
    v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    final int targtetHeight = v.getMeasuredHeight();

    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation()
    {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1
                    ? LayoutParams.WRAP_CONTENT
                    : (int)(targtetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration(((int) (targtetHeight / v.getContext().getResources().getDisplayMetrics().density))*2);
    v.startAnimation(a);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号