?
本文檔使用 php中文網(wǎng)手冊 發(fā)布
ViewAnimator
版本:Android 2.3 r1
?
public class ViewAnimator extends FrameLayout
?
java.lang.Object
???????? android.view.View
? ???? ???????? android.view.ViewGroup
??????????????????????????? android.widget.FrameLayout
???????????????????????????????????? android.widget.ViewAnimator
?
已知直接子類
???????? ViewFlipper, ViewSwitcher
?
已知間接子類
???????? ImageSwitcher, TextSwitcher
?
概述
???????? FrameLayout容器的基類,當進行視圖切換時顯示動畫效果。
???????? (譯者注:此類不常用,常用其直接子類ViewFlipper, ViewSwitcher或間接子類ImageSwitcher, TextSwitcher)
?
XML屬性
屬性名稱 |
描述 |
android:inAnimation |
(譯者注:設置View進入屏幕時候使用的動畫) |
android:outAnimation |
(譯者注:設置View離開屏幕時候使用的動畫) |
?
公共方法???????
???????? public void addView (View child, int index, ViewGroup.LayoutParams params)
???????? 添加一個具有指定布局參數(shù)子視圖。
?????????????????? 參數(shù)
??????????????????????????? child ??????? 添加的子視圖
??????????????????????????? index ????? 添加的子視圖所在的位置
??????????????????????????? params ? 設置子視圖的布局參數(shù)
?
???????? public int getBaseline ()
???????? 返回widget的文本基線到widget上邊界的偏移量,如果當前widget不支持基線對齊,此方法返回-1
?????????????????? 返回值
??????????????????????????? 在widget界限內(nèi)基線的偏移量,如果不支持基線對齊,返回-1
?
???????? public View getCurrentView ()
???????? 返回與當前顯示的子元素相應的視圖
?????????????????? 返回值
??????????????????????????? 當前顯示的視圖
?????????????????? 參見
??????????????????????????? getDisplayedChild()
?
???????? public int getDisplayedChild ()
???????? 返回當前顯示的子視圖的索引
?
???????? public Animation getInAnimation ()
???????? 返回被用來顯示視圖進入屏幕的動畫
?????????????????? 返回值
??????????????????????????? 一個動畫對象animation,如果沒有設置的話,返回一個null
?????????????????? 參見
??? ?????????????????? setInAnimation(android.view.animation.Animation)
??? ?????????????????? setInAnimation(android.content.Context,
int)
?
???????? public Animation getOutAnimation ()
返回被用來顯示視圖離開屏幕的動畫
?????????????????? 返回值
??????????????????????????? 一個動畫對象animation,如果沒有設置的話,返回一個null
?????????????????? 參見
??????????????????????????? setOutAnimation(android.view.animation.Animation)
??????????????????????????? setOutAnimation(android.content.Context,
int)
?
???????? public void removeAllViews ()
???????? 調(diào)用此方法從ViewGroup中移除所有的子視圖
?
???????? public void removeViewAt (int index)
???????? 移除組(group)中指定位置上的視圖
?????????????????? 參數(shù)
??????????????????????????? index ????? 需要移除的視圖在組中的位置
?
???????? public void removeViewInLayout (View view)
???????? 在布局時移除一個視圖。當你需要在onLayout()中移除一個視圖時,此方法很有用。
?????????????????? 參數(shù)
??????????????????????????? view ??????? 要從組中移除的視圖
?
???????? public void removeViews (int start, int count)
???????? 從組中移除指定范圍的視圖
?????????????????? 參數(shù)
??????????????????????????? start ?????? 要移除的多個視圖在組中的開始位置
??????????????????????????? count ????? 移除視圖的數(shù)量
?
???????? public void removeViewsInLayout (int start, int count)
???????? 在布局時移除一組視圖。當你需要在onLayout()中移除很多視圖時,此方法很有用。
?????????????????? 參數(shù)
??????????????????????????? start ?????? 移除的多個視圖在組中第一個視圖的索引
??????????????????????????? count ????? 移除視圖的數(shù)量
?
???????? public void setAnimateFirstView (boolean animate)
???????? 設置當前視圖在首次加載時是否動畫顯示。
?????????????????? 參數(shù)
??????????????????????????? animate 在第一次顯示當前視圖時,是否動畫顯示
?
???????? public void setDisplayedChild (int whichChild)
???????? 設置哪個子視圖將被顯示出來
?????????????????? 參數(shù)
??????????????????????????? whichChild ???? 將要顯示的子視圖的索引
?
???????? public void setInAnimation (Animation inAnimation)
???????? 設置視圖進入屏幕時使用的動畫。
?????????????????? 參數(shù)
??????????????????????????? inAnimation ?? 視圖進入屏幕時使用的動畫??????????????????
?????????????????? 參見
??????????????????????????? getInAnimation()
??????????????????????????? setInAnimation(android.content.Context,
int)
?
???????? public void setInAnimation (Context context, int resourceID)
???????? 設置視圖進入屏幕時使用的動畫。
?????????????????? 參數(shù)
??????????????????????????? context ? 上下文
??????????????????????????? resourceID ???? 動畫的資源id
?????????????????? 參見
??????????????????????????? getInAnimation()
??????????????????????????? setInAnimation(android.view.animation.Animation)
?
???????? public void setOutAnimation (Animation outAnimation)
???????? 設置視圖退出屏幕時使用的動畫
?????????????????? 參數(shù)
??????????????????????????? outAnimation ???????? 當視圖退出屏幕時開始的動畫
?????????????????? 參見
??????????????????????????? getOutAnimation()
??????????????????????????? setOutAnimation(android.content.Context,
int)
?
???????? public void setOutAnimation (Context context, int resourceID)
???????? 設置視圖退出屏幕時使用的動畫
?????????????????? 參數(shù)
??????????????????????????? context ? 上下文
??????????????????????????? resourceID ???? 動畫的資源id
?????????????????? 參見
??????????????????????????? getOutAnimation()
??????????????????????????? setOutAnimation(android.view.animation.Animation)
?
???????? public void showNext ()
???????? 手動顯示下一個子視圖
?
???????? public void showPrevious ()
???????? 手動顯示上一個子視圖
?
補充
???????? 文章精選
?????????????????? Android-自定義切換視圖一
???????? ???????? Ophone 2D UI 動畫教程之二——屏幕切換效果實現(xiàn)
?