Android Display GIF picture examples detailed _android

Source: Internet
Author: User

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

<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= is 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, "

Hope that through this article, can help you solve this problem, thank you for your support of this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.