Because of the project, you have to have an animated wait effect, the first time to think of is GIF (lazy, easy), but tried a lot of it is said to be able to play the GIF control, but also wrote, but put on the Phantom of the mobile phone is not play, all think of a trick, since GIF can be played in the browser, the Android WebView also can play, wrote a demo, sure enough to play.
1, put the GIF file into the Android resource folder
2, write HTML, put the Android GIF source into the webview inside to load
<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:paddingleft= "@dimen/activity_horizontal_margin"
android:paddingright= "@dimen/activity_ Horizontal_margin "
android:paddingtop=" @dimen/activity_vertical_margin "
android:paddingbottom=" @dimen Activity_vertical_margin "
tools:context=". Mainactivity ">
<webview
android:id=" @+id/webview "android:layout_width=" Match_parent "
android:layout_height= "Match_parent" >
</WebView>
</RelativeLayout>
3, the use of the Code
@Override
protected void onCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
Setcontentview (r.layout.activity_main);
WebView WebView = (webview) Findviewbyid (R.id.webview);
Webview.loaddatawithbaseurl (NULL,
"
OK, now it's ready to play and it feels like it can fit any model.
The above is a small set to introduce Android to play GIF animation tricks, hope to help everyone!