private static class GIFView extends View{
Movie movie;
InputStream is=null;
long moviestart;
public GIFView(Context context)
{
super(context);
is=context.getResources().openRawResource(R.drawable.smile);
movie=Movie.decodeStream(is);
}
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
long now=android.os.SystemClock.uptimeMillis();
if (moviestart == 0) { // first time
moviestart = now;
}
int relTime = (int)((now - moviestart) % movie.duration()) ;
movie.setTime(relTime);
movie.draw(canvas,100,100);
this.invalidate();
}
}
используйте этот класс и добавьте представление в свой макет,
GIFView view=new GIFView(this);
linear=(LinearLayout)findViewById(R.id.linear);
linear.addView(view);
это может помочь вам ..