Android Learning Note (25): View Toggle Viewanimator and its subclasses that drive the drawing effect

Source: Internet
Author: User

The Viewanimator can realize the View Toggle of the drawing effect , and its derived subclasses are some of the components with animation effect switching function.

XML attributes supported by Viewanimator:

Attribute Name

Description

Android:animatefirstview

Set whether animations are used when displaying the first view component

Android:inanimation

To set the animation used when displaying components

Android:outanimation

Animate when you set a hidden component

1. Viewswitcher View switch component.

Ways to add Views:

Create Viewfrom viewfactory , and then through viewswitcher 's setfactory ( Viewswitcher.viewfactory) added.

Switch:

Showprevious () and shownext ()

2.ImageSwitcher Image Switcher

The View component returned by the Viewfactory Makeview () method must be ImageView .

Because the showprevious () and shownext () methods are overridden, you can call setimagedrawable (drawable drawable),setimageresource (int resid) , and Setimageuri (Uri uri) methods to replace the picture.

3. Textswitcher Text Switcher

The View component returned by the Viewfactory Makeview () method must be TextView .

When you switch text, you only need to call the SetText () method.

4.ViewFlipper

Inherited from viewanimator, like the adapterviewflipper, there are many common XML attributes, but do not need to pass Adapter Add a list item, you can add multiple viewby AddView (view v) .

Android Learning Note (25): View Toggle Viewanimator and its subclasses that drive the drawing effect

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.