我想在警报框中播放 gif 动画。我正在尝试使用
public class Fruits extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fruits);
ImageButton apple = (ImageButton)findViewById(R.id.imageButton1);
apple.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(Fruits.this);
GIFWebView view = new GIFWebView(this, "file:///android_asset/apple.gif");
setContentView(view);
builder.create().show();
}
});
}
GIFWebView 类
public class GIFWebView extends WebView {
public GIFWebView(Context context, String path) {
super(context);
loadUrl(path);
// TODO Auto-generated constructor stub
}
}
但不能。