RImageView.java 文件源码

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

项目:RLibrary 作者:
public void setImageBitmap(@Nullable final Drawable fromDrawable, @Nullable final Bitmap toBitmap) {
    final int width = getMeasuredWidth();
    final int height = getMeasuredHeight();

    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            final TransitionDrawable td = new TransitionDrawable(new Drawable[]{
                    fromDrawable, new BitmapDrawable(getResources(),
                    getScaleType() == ScaleType.CENTER_CROP ?
                            centerCrop(getResources(), toBitmap, width, height) :
                            toBitmap)});
            RImageView.super.setImageDrawable(td);
            td.startTransition(300);
        }
    };

    if (width == 0 || height == 0) {
        post(runnable);
    } else {
        runnable.run();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号