目录 搜索
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
文字


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)

         添加一个具有指定布局参数子视图

                   参数

                            child         添加的子视图

                            index       添加的子视图所在的位置

                            params   设置子视图的布局参数

 

         public int getBaseline ()

         返回widget的文本基线到widget上边界的偏移量,如果当前widget不支持基线对齐,此方法返回-1

                   返回值

                            widget界限内基线的偏移量,如果不支持基线对齐,返回-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 ()

         调用此方法从ViewGroup中移除所有的子视图

 

         public void removeViewAt (int index)

         移除组(group)中指定位置上的视图

                   参数

                            index       需要移除的视图在组中的位置

 

         public void removeViewInLayout (View view)

         在布局时移除一个视图。当你需要在onLayout()中移除一个视图时,此方法很有用。

                   参数

                            view         要从组中移除的视图

 

         public void removeViews (int start, int count)

         从组中移除指定范围的视图

                   参数

                            start        要移除的多个视图在组中的开始位置

                            count       移除视图的数量

 

         public void removeViewsInLayout (int start, int count)

         在布局时移除一组视图。当你需要在onLayout()中移除很多视图时,此方法很有用。

                   参数

                            start        移除的多个视图在组中第一个视图的索引

                            count       移除视图的数量

 

         public void setAnimateFirstView (boolean animate)

         设置当前视图在首次加载时是否动画显示。

                   参数

                            animate 在第一次显示当前视图时,是否动画显示

 

         public void setDisplayedChild (int whichChild)

         设置哪个子视图将被显示出来

                   参数

                            whichChild      将要显示的子视图的索引

 

         public void setInAnimation (Animation inAnimation)

         设置视图进入屏幕时使用的动画。

                   参数

                            inAnimation    视图进入屏幕时使用的动画                  

                   参见

                            getInAnimation()

                            setInAnimation(android.content.Context, int)

 

         public void setInAnimation (Context context, int resourceID)

         设置视图进入屏幕时使用的动画。

                   参数

                            context   上下文

                            resourceID      动画的资源id

                   参见

                            getInAnimation()

                            setInAnimation(android.view.animation.Animation)

 

         public void setOutAnimation (Animation outAnimation)

         设置视图退出屏幕时使用的动画

                   参数

                            outAnimation          当视图退出屏幕时开始的动画

                   参见

                            getOutAnimation()

                            setOutAnimation(android.content.Context, int)

 

         public void setOutAnimation (Context context, int resourceID)

         设置视图退出屏幕时使用的动画

                   参数

                            context   上下文

                            resourceID      动画的资源id

                   参见

                            getOutAnimation()

                            setOutAnimation(android.view.animation.Animation)

 

         public void showNext ()

         手动显示下一个子视图

 

         public void showPrevious ()

         手动显示上一个子视图

 

补充

         文章精选

                   Android-自定义切换视图一

                  Ophone 2D UI 动画教程之二——屏幕切换效果实现

 


上一篇: 下一篇: