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

  • 相关阅读:
    python dict
    用Python requests beautifulSoup 获取并显示中文信息
    Python information to learn
    Python 中的异常
    Python 中的函数
    安装Linux系统Fedora 23
    (转)开源协议的比较
    WizNote for linux installation
    linux下编译bib、tex生成pdf文件
    NLP学术组织、会与论文
  • 原文地址:https://www.cnblogs.com/zhangqie/p/10845677.html
Copyright © 2011-2022 走看看