Show .gif with android.graphics.Movie

前端 未结 3 1432
夕颜
夕颜 2021-02-01 06:46

I\'m trying, create a view with an animated GIF..

When i try run the follow code in emulator all works fine. But when i try run in real Smart Phone, nothing happens..

3条回答
  •  长发绾君心
    2021-02-01 07:22

    Loading an animated GIF seems tricky, but I would suggest to use a WebView as an alternative.

    Do as follow to resolve the problem :

    1. Copy your GIF in Android Assets.
    2. Call webView.loadDataWithBaseURL("file:///android_asset/", "", "text/html", "utf-8", null);

    I hope it helps !

提交回复
热议问题