Android 2.3 r1 Chinese API (78) -- ViewAnimator

Source: Internet
Author: User

 

Preface

This chapter is about android. widget. ViewAnimator. The version is Android 2.3 r1. It is translated from "madgoat". You are welcome to visit his blog: http://madgoat.cn/. Thank you again "madgoat "! I look forward to you join the Android Chinese translation group, contact my over140@gmail.com.

 

Statement

You are welcome to repost, but please keep the original source of the article :)

Blog Garden: http://www.cnblogs.com/

Android Chinese translation group: http://code.taobao.org/project/view/404/

 

Body

I. Structure

 

    Public class ViewAnimator extends FrameLayout

 

Java. lang. Object

Android. view. View

Android. view. ViewGroup

Android. widget. FrameLayout

Android. widget. ViewAnimator

 

 

Ii. Overview

     FrameLayoutThe base class of the container. The animation effect is displayed when the view is switched.

(Note: This class is not commonly used. It is often used for its direct subclass ViewFlipper, ViewSwitcher, or indirect subclass ImageSwitcher, TextSwitcher)

 

 

Iii. XML attributes

 

Attribute name

Description

Android: inAnimation

(Translator's note: Set ViewEnterAnimation used on the screen)

Android: outAnimation

(Translator's note: Set ViewLeaveAnimation used on the screen)

 

 

Iv. Public Methods

 

Public voidAddView(View child, int index, ViewGroup. LayoutParams params)

Add a subview with the specified layout parameters.

Parameters

Child View

Position of the subview added by index

Params: Set the layout parameters of the subview

 

Public intGetBaseline()

Returns the offset from the text baseline of the widget to the upper boundary of the widget. If the current widget does not support baseline alignment,-1 is returned.

Return Value

The baseline offset within the widget limit. If baseline alignment is not supported,-1 is returned.

 

Public ViewGetCurrentView()

Returns the view corresponding to the currently displayed child element.

Return Value

View currently displayed

See

getDisplayedChild()

 

Public intGetDisplayedChild()

Returns the index of the currently displayed subview.

 

Public AnimationGetInAnimation()

Returns the animation that is used to display the view on the screen.

Return Value

An animation object, if not set, returns a null

See

setInAnimation(android.view.animation.Animation)

setInAnimation(android.content.Context, int)

 

Public AnimationGetOutAnimation()

Returns an animation used to display the view's exit from the screen.

Return Value

An animation object, if not set, returns a null

See

setOutAnimation(android.view.animation.Animation)

setOutAnimation(android.content.Context, int)

 

Public voidRemoveAllViews()

Call this method to remove all child views from the ViewGroup.

 

Public voidRemoveViewAt(Int index)

Remove a view from a group at a specified position

Parameters

Position of the view to be removed from the index in the group

 

Public voidRemoveViewInLayout(View view)

Remove a view from the layout. This method is useful when you need to remove a view from onLayout.

Parameters

View to be removed from the group

 

Public voidRemoveViews(Int start, int count)

Remove a view with a specified range from the group

Parameters

The start position of multiple views to be removed from the group.

Count number of views removed

 

Public voidRemoveViewsInLayout(Int start, int count)

Remove a group of views during layout. This method is useful when you need to remove many views from onLayout.

Parameters

Index of the first view in the group of multiple views removed by start

Count number of views removed

 

Public voidSetAnimateFirstView(Boolean animate)

Sets whether the current view is animated when it is loaded for the first time.

Parameters

Whether the animation is displayed when the current view is displayed for the first time.

 

Public voidSetDisplayedChild(Int whichChild)

Specifies the subview to be displayed.

Parameters

The index of the subview to be displayed by whichChild

 

Public voidSetInAnimation(Animation inAnimation)

Set the animation used when the view enters the screen.

Parameters

Animation used when the inAnimation view enters the screen

See

getInAnimation()

setInAnimation(android.content.Context, int)

 

Public voidSetInAnimation(Context context, int resourceID)

Set the animation used when the view enters the screen.

Parameters

Context

ResourceID: The resource id of the animation.

See

getInAnimation()

setInAnimation(android.view.animation.Animation)

 

Public voidSetOutAnimation(Animation outAnimation)

Set the animation used when the view exits the screen

Parameters

OutAnimation animation starting when the view exits the screen

See

getOutAnimation()

setOutAnimation(android.content.Context, int)

 

Public voidSetOutAnimation(Context context, int resourceID)

Set the animation used when the view exits the screen

Parameters

Context

ResourceID: The resource id of the animation.

See

getOutAnimation()

setOutAnimation(android.view.animation.Animation)

 

Public voidShowNext()

Manually display the next subview

 

Public voidShowPrevious()

Manually display the previous subview

 

 

5. Supplement

Article Selection

Android-custom switchover view 1

Ophone 2D UI animation tutorial 2-Implementation of screen Switching

 

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.