android Display GIF Picture example detailed
Images in GIF format are not supported on Android, but because I want to be loaded in my program just when a villain is running indicates that it is loading. And this villain runs is a GIF picture. That is, you want the program to load a GIF image as soon as it starts. Look up some methods on the internet I don't know if the version of Android I use is high (android4.4) or what the problem is that it doesn't load. Finally thought of a way to load it out. The idea is to put the GIF in the WebView to show it.
Here's the code for this:
Activity_prepare_fullscreen.xml file
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<relativelayout xmlns:android=" http://schemas.android.co M/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= loading Please wait ... "Android: Textcolor= "#33b5e5" android:textsize= "30sp" android:textstyle= "bold"/> ;/relativelayout> |
Preparefullscreenactivity.java file
The extra is not posted, this is the main two sentences
Private WebView Runwebview=null;
Runwebview = (webview) Findviewbyid (R.id.runwebview);
The next sentence is to put the file, the file in the assents decentralized
Runwebview.loaddatawithbaseurl (NULL, "
"," text/html "," UTF-8 ", null);