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