Use animated effects to replace progressdialog

Source: Internet
Author: User

Sometimes, when logging on to obtain data, you need to use a circular progress, but you do not want to use a dialog, because the dialog should be popped up so that the page will lose the focus.

You can use the animation effect to replace it.

Add an imageview to the XML file and set the background to an animation.

Code:

<Imageview
Android: Id = "@ + ID/logining_anim_imgview"
Android: Background = "@ anim/logining_anim"
Android: gravity = "center"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content">
</Imageview>

Anim/logining_anim:

<? XML version = "1.0" encoding = "UTF-8"?>
<Animation-list
Xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: oneshot = "false">
<Item
Android: duration= "150"
Android: drawable = "@ drawable/login_1">
</Item>
<Item
Android: duration= "150"
Android: drawable = "@ drawable/login_2">
</Item>
<Item
Android: duration= "150"
Android: drawable = "@ drawable/login_3">
</Item>
<Item
Android: duration= "150"
Android: drawable = "@ drawable/login_4">
</Item>
<Item
Android: duration= "150"
Android: drawable = "@ drawable/login_5">
</Item>
<Item
Android: duration= "150"
Android: drawable = "@ drawable/login_6">
</Item>
</Animation-List>

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.