zoukankan      html  css  js  c++  java
  • android -------- GifView 显示gif图片

    最近的项目需要在界面显示Gif动图,查找网络资料,总结了一下,分享一下,


    一个GifView的gif图加载库以有效地显示GIF,

    您可以启动,暂停和停止gifView

    在app 的 build.gradle 中

    implementation 'com.github.Cutta:GifView:1.4'

    效果图:

      

    1:布局直接显示

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >
            <com.cunoraz.gifview.library.GifView
                android:id="@+id/gif1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                custom:gif="@mipmap/gif1" />
    
    
    
            <com.cunoraz.gifview.library.GifView
                android:id="@+id/gif3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="15dp"
                />
    
        </LinearLayout>

    2:代码

    /***
         *  属性
         * 
         *   gifView1.setGifResource(R.mipmap.gif_start_stop);
         *   gifView1.play();
         *   gifView1.pause();
         *   gifView1.setGifResource(R.mipmap.gif5);
         *   gifView1.getGifResource();
         *   gifView1.setMovieTime(time);
         *   gifView1.getMovie();
         */
    
        private void show(){
            btn1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
    
                    if (gifView1.isPlaying())
                        gifView1.pause();
                }
            });
            btn2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
    
                    if (gifView1.isPaused())
                        gifView1.play();
                }
            });
        }

    代码文档:https://github.com/Cutta/GifView

  • 相关阅读:
    webpack 报错(Cannot find moudle ‘webpack-cliinconfig-yargs‘)
    js图片压缩推荐
    Object.assign()更新对象
    poj 2063完全背包
    poj 3592 缩点+SPFA
    hdu2546 01背包 重学背包
    hdu 2503 1713 1108 最小公倍数&最大公约数
    poj3249 拓扑排序+DP
    poj2914无向图的最小割模板
    poj2942(双联通分量,交叉染色判二分图)
  • 原文地址:https://www.cnblogs.com/zhangqie/p/10845677.html
Copyright © 2011-2022 走看看