在android的imagebutton上显示gif
我想知道是否可以在图像按钮上显示gif动画。我遵循了Android API BitmapDecode示例上的示例,现在可以在画布上显示动画GIF 是否可以在imagebutton上显示相同的gif。我尝试使用setBackgroundDrawable和setImageDrawable,但它给了我一个空按钮在android的imagebutton上显示gif,android,Android,我想知道是否可以在图像按钮上显示gif动画。我遵循了Android API BitmapDecode示例上的示例,现在可以在画布上显示动画GIF 是否可以在imagebutton上显示相同的gif。我尝试使用setBackgroundDrawable和setImageDrawable,但它给了我一个空按钮 @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.test);
ImageButton btn = (ImageButton) findViewById(R.id.ImageButton01);
SampleView p=new SampleView(this);
p.setDrawingCacheEnabled(true);
p.buildDrawingCache();
btn.setBackgroundDrawable(p.getBackground());
}
SampleView类与中提供的类似,我已经删除了所有其他代码段,现在它只显示gif动画
谢谢,
新家伙。我想这应该是可能的,就像ImageView一样-将动画分割为帧,然后使用android逐帧动画为这些帧设置动画。有关如何使用这种逐帧动画的详细信息,请参阅