使用TransitionDrawable实现渐变效果

来源:互联网 发布:淘宝网店开店 编辑:程序博客网 时间:2024/04/28 17:16
   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 0