mParser.decodeFromAssets("voice/enter_motuo.svga", new SVGAParser.ParseCompletion() {
@RequiresApi(api = Build.VERSION_CODES.P)
@Override
public void onComplete(@NotNull SVGAVideoEntity videoItem) {
if (vip_animation != null) {
//替换元素
SVGADynamicEntity dynamicItem = new SVGADynamicEntity();
SVGADrawable drawable = new SVGADrawable(videoItem, dynamicItem);
TextPaint textPaint = new TextPaint();
textPaint.setTextSize(24);
textPaint.setFakeBoldText(true);
textPaint.setARGB(0xff, 0xff, 0xff, 0xff);
textPaint.setShadowLayer((float) 0.0, (float) 0.0, (float) 0.0, Color.WHITE); // 各种配置
dynamicItem.setDynamicText("xxxx驾到", textPaint, "juxing2");
enter_animation.setImageDrawable(drawable);
enter_animation.startAnimation();
//我这里要转圆形图片 所以我先转成bitmap 对图片没要求的 可以直接是图片的地址
RequestOptions options = new RequestOptions()
.priority(Priority.NORMAL)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.skipMemoryCache(true)
.error(R.drawable.default_avater_gray)
.centerCrop()
.circleCrop();
Glide.with(mContext).asBitmap().apply(options).load(enterBean.getThumbIconURL()).into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap bitmap, @Nullable Transition<? super Bitmap> transition) {
dynamicItem.setDynamicImage(bitmap, "juxing1"); //nvt是替换的图片的名称
}
});
enter_animation.setImageDrawable(drawable);
enter_animation.startAnimation();
}