简体   繁体   中英

JAVA - How to get Image animated from GIF

Hi can i get an animated image (gold.gif) with BitmapFactory, i try this line but it's not animated

image1 = BitmapFactory.decodeResource(getResources(),R.drawable.gold);

ps : i am a beginner

Android support GIF animation using android.graphics.Movie class. On every frame update you need to set Movie.setTime() with elapsed time since last frame update and then you call Movie.draw() to draw it on a canvas.

However some people report Movie class is not very reliable and undocumented. I prefer extract GIF animation frame using graphics editor such Photoshop and then put each extracted frame as separate image in /res/drawable which then I can refer with AnimationDrawable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM