0
点赞
收藏
分享

微信扫一扫

使用TransitionDrawable实现渐变效果

程序员知识圈 2022-06-01 阅读 38

   private void setImageBitmap(ImageView imageView, Bitmap bitmap) {
        // Use TransitionDrawable to fade in.
        final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mContext.getResources(), bitmap) });
        //noinspection deprecation
            imageView.setBackgroundDrawable(imageView.getDrawable());
        imageView.setImageDrawable(td);
        td.startTransition(200);
    }


举报

相关推荐

0 条评论