Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在ImageView中显示动画GIF_Android_Animated Gif - Fatal编程技术网

Android 如何在ImageView中显示动画GIF

Android 如何在ImageView中显示动画GIF,android,animated-gif,Android,Animated Gif,如何在Imageview中显示动画Gif我使用了Drawable文件夹中的Gif,它不像Gif那样令人不快。Nee帮助plz 这是我的Imageview代码 <ImageView android:layout_width="40dp" android:id="@+id/ivGif" android:src="@drawable/success_bg" android:layout_hei

如何在Imageview中显示动画Gif我使用了Drawable文件夹中的Gif,它不像Gif那样令人不快。Nee帮助plz

这是我的Imageview代码

    <ImageView
            android:layout_width="40dp"
            android:id="@+id/ivGif"
            android:src="@drawable/success_bg"
            android:layout_height="40dp"
            android:gravity="center|bottom"
            android:visibility="visible" />

使用此库

编译“pl.droidsonroids.gif:android gif可绘制:1.2.3”

<pl.droidsonroids.gif.GifImageView
        android:id="@+id/gif_iv"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:scaleType="centerCrop"
        android:src="@drawable/ic_ani_gif"
        app:layout_anchor="@+id/rl_holder_view"
        app:layout_anchorGravity="center|top" />

使用此库

编译“pl.droidsonroids.gif:android gif可绘制:1.2.3”

<pl.droidsonroids.gif.GifImageView
        android:id="@+id/gif_iv"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:scaleType="centerCrop"
        android:src="@drawable/ic_ani_gif"
        app:layout_anchor="@+id/rl_holder_view"
        app:layout_anchorGravity="center|top" />

试试这个:

 "android.resource://[package]/[res id]"

    Uri myUri =("android.resource://" + context.getPackageName() + "/"
                        + R.drwable.mygifimage);
    try{
        Url myUrl = myUri.toURL();
        webView wView = new webView(this);   
        wView.loadUrl(myUrl);
        setContentView(view);

       }catch(Exception e){
              e.printStackTrace()
       }
试试这个:

 "android.resource://[package]/[res id]"

    Uri myUri =("android.resource://" + context.getPackageName() + "/"
                        + R.drwable.mygifimage);
    try{
        Url myUrl = myUri.toURL();
        webView wView = new webView(this);   
        wView.loadUrl(myUrl);
        setContentView(view);

       }catch(Exception e){
              e.printStackTrace()
       }

我刚刚使用了此代码及其工作原理 首先添加库

编译“pl.droidsonroids.gif:android gif可绘制:1.2.3”

然后将gif布局设置为您希望这样放置gif的位置

<pl.droidsonroids.gif.GifTextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/your_gif"/>

我刚刚使用了此代码及其工作原理 首先添加库

编译“pl.droidsonroids.gif:android gif可绘制:1.2.3”

然后将gif布局设置为您希望这样放置gif的位置

<pl.droidsonroids.gif.GifTextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/your_gif"/>


我不明白,你想要什么。看到这个答案,或者尝试这个不可理解的问题,可能你必须在给定的链接中使用try解决方案。我不明白,你想要什么。看到这个答案,或者尝试这个不可理解的问题,可能你必须在给定的链接中使用try解决方案。可能的重复可能的重复