android 显示gif图片
来源:互联网 发布:用友软件上海分公司 编辑:程序博客网 时间:2024/04/29 16:44
在android中不支持gif格式的图片,但是由于我希望在我的程序中刚刚加载的时候有一个小人在跑步表示正在加载。而这个小人跑就是一个gif图片。也就是希望程序一启动时就加载gif图片。在网上查找了一些方法不知道是我使用的android的版本高(android4.4)还是什么问题就是加载不出来。最后想了一个办法加载了出来。这个办法就是将gif放在webView中让其显示。
下面是关于这个的代码:
activity_prepare_fullscreen.xml文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F3F3F3"
>
<WebView
android:id="@+id/runWebView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/fullscreen_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/runWebView"
android:layout_centerHorizontal="true"
android:gravity="center"
android:keepScreenOn="true"
android:text="正在加载请等待..."
android:textColor="#33b5e5"
android:textSize="30sp"
android:textStyle="bold" />
</RelativeLayout>
PrepareFullscreenActivity.java 文件
多余的就不贴了,这是主要的两句
private WebView runWebView=null;
runWebView = (WebView) findViewById(R.id.runWebView);
下一句就是放入文件,文件在assents下放着呢
runWebView.loadDataWithBaseURL(null,"<HTML><body bgcolor='#f3f3f3'><div align=center><IMG src='file:///android_asset/run.gif'/></div></body></html>", "text/html", "UTF-8",null);
今天博客排名终于有名次了,超开心。。。。。。
- android 显示gif图片
- android显示gif图片
- Android显示GIF图片
- android显示gif图片
- android 显示gif图片
- android显示GIF图片
- Android显示gif图片
- Android显示GIF图片
- android 显示gif图片
- Android显示GIF图片
- Android显示Gif图片
- android 显示gif图片
- android显示gif图片
- Android gif图片显示
- Android-GIF图片显示
- Android APIDemo gif图片显示
- android显示gif图片(上)
- Android显示gif格式图片
- vector.resize 与 vector.reserve的区别
- android gps定位
- CSS中zoom:1的作用 ,小标签大作用
- UI 基础控件(一)-----------UILabel
- 导入工程的“The importandroid.os cannot be resolved”错误解决办法
- android 显示gif图片
- 如何简化从hbase中查询数据
- 使用boost.python在python调用C++接口(windows)
- linux ------ 闲聊input设备
- windows与office
- NS2中的数据包common头结构hdr_cmn
- unity3d 制作动态天空盒——实现时时环境反射
- BZOJ3170[TJOI2013]松鼠聚会
- 修改ubuntu下Eclipse默认的黑色注释