Images in gif format are not supported in android, but because I want to have a villain in my program loading, it indicates that the image is being loaded. This villain is a GIF image. That is, you want to load the GIF image as soon as the program starts. I found some methods on the Internet, but I don't know whether the android version I used is high (android4.4) or what is the problem. Finally, I figured out a way to load it. This method is to put the gif in webView for display.
The following code is about this:
Activity_prepare_fullscreen.xml File
<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 = "loading... please wait ..."
Android: textColor = "#33b5e5"
Android: textSize = "30sp"
Android: textStyle = "bold"/>
</RelativeLayout>
PrepareFullscreenActivity. java File
If it is unnecessary, it will not be pasted. This is the main two sentences.
Private WebView runWebView = null;
RunWebView = (WebView) findViewById (R. id. runWebView );
The next sentence is put into a file, which is put under assents.
RunWebView. loadDataWithBaseURL (null, "<HTML> <body bgcolor = '# f3f3f3'> <div align = center> </div> </body>