作为问题,我使用ImageSpan将图像添加到TextView中.但是它不能
动画.你有任何建议吗?我尝试扩展AnimationDrawable以将drawable添加到ImageSpan中.但它不起作用
public class EmoticonDrawalbe extends AnimationDrawable {
private Bitmap bitmap;
private GifDecode decode;
private int gifCount;
public EmoticonDrawalbe(Context context, String source) {
decode = new GifDecode();
decode.read(context, source);
gifCount = decode.getFrameCount();
if (gifCount <= 0) {
return;
}
for (int i = 0; i < gifCount; i++) {
bitmap = decode.getFrame(i);
addFrame(new BitmapDrawable(bitmap), decode.getDelay(i));
}
setOneShot(false);
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
start();
}
}
Run Code Online (Sandbox Code Playgroud)