目录搜索
androidManifestManifest.permissionManifest.permission_groupandroid.accessibilityserviceAccessibilityServiceandroid.accountsAccountandroid.appNotificationManagerandroid.bluetoothBluetoothAdapterBluetoothClassBluetoothClass.DeviceBluetoothClass.Device.MajorBluetoothClass.ServiceBluetoothDeviceBluetoothServerSocketBluetoothSocketandroid.contentSharedPreferencesandroid.database.sqliteSQLiteCursorDriverSQLiteOpenHelperandroid.graphicsBitmapandroid.locationLocationListenerGeocoderGpsStatusGpsStatus.ListenerGpsStatus.NmeaListenerGpsSatelliteandroid.mediaAudioFormatAsyncPlayerAudioRecordAudioRecord.OnRecordPositionUpdateListenerThumbnailUtilsAudioManagerandroid.netTrafficStatsMailToLocalSocketandroid.osAsyncTaskAsyncTask.StatusCountDownTimerMessageMessageQueueHandlerThreadandroid.textHtmlandroid.utilJsonWriterandroid.viewContextMenuContextMenu.ContextMenuInfoDisplayViewManagerViewViewStubViewTreeObserverViewParentWindowManagerGestureDetectorGravityMenuInflaterScaleGestureDetectorSoundEffectConstantsandroid.view.inputmethodInputConnectionInputMethodInputMethodSessionBaseInputConnectionInputMethodManagerandroid.widgetAbsListViewAbsListView.LayoutParamsAbsListView.OnScrollListenerAbsListView.RecyclerListenerAbsoluteLayoutAbsoluteLayout.LayoutParamsAbsSeekBarAbsSpinnerAdapterViewAdapterView.AdapterContextMenuInfoAdapterView.OnItemLongClickListenerAdapterView.OnItemSelectedListenerAdapterView.OnItemClickListenerAnalogClockBaseAdapterBaseExpandableListAdapterButtonCheckBoxCheckedTextViewCheckableChronometerChronometer.OnChronometerTickListenerCompoundButtonCompoundButton.OnCheckedChangeListenerCursorAdapterCursorTreeAdapterDatePickerDatePicker.OnDateChangedListenerDialerFilterDigitalClockEditTextFilterFilter.FilterListenerFilter.FilterResultsExpandableListAdapterExpandableListView.OnChildClickListenerExpandableListView.OnGroupClickListenerExpandableListView.OnGroupCollapseListenerExpandableListView.OnGroupExpandListenerFilterableGalleryGallery.LayoutParamsGridViewGridLayoutGridLayout.AlignmentRadioGroupImageViewImageView.ScaleTypeHorizontalScrollViewImageButtonImageSwitcherFilterQueryProviderListAdapterListViewMediaControllerMultiAutoCompleteTextViewMultiAutoCompleteTextView.CommaTokenizerMultiAutoCompleteTextView.TokenizerQuickContactBadgeRadioButtonRatingBarRatingBar.OnRatingBarChangeListenerRelativeLayoutRemoteViewsResourceCursorAdapterResourceCursorTreeAdapterScrollerScrollViewSearchViewSearchView.OnCloseListenerSearchView.OnQueryTextListenerSearchView.OnSuggestionListenerSeekBarSeekBar.OnSeekBarChangeListenerSimpleAdapterSimpleAdapter.ViewBinderSimpleCursorAdapterSimpleCursorAdapter.CursorToStringConverterSimpleCursorAdapter.ViewBinderSimpleCursorTreeAdapterSimpleCursorTreeAdapter.ViewBinderSimpleExpandableListAdapterSlidingDrawerSlidingDrawer.OnDrawerCloseListenerSlidingDrawer.OnDrawerOpenListenerSlidingDrawer.OnDrawerScrollListenerSpinnerSpinnerAdapterWrapperListAdapterTabHostTabHost.TabSpecTextViewTimePickerTimePicker.OnTimeChangedListenerToastTableLayoutTableLayout.LayoutParamsTableRowTableRow.LayoutParamsTabWidgetTextSwitcherToggleButtonTwoLineListItemVideoViewViewAnimatorViewFlipperViewSwitcherViewSwitcher.ViewFactoryZoomButtonsControllerZoomButtonsController.OnZoomListenerZoomButtonZoomControlsdalvik.systemDexFile
文字


ViewSwitcher

版本:Android 2.3 r1

 

结构

继承关系

public class ViewSwitcher extends ViewAnimator

        

java.lang.Object

android.view.View

         android.view.ViewGroup

                   android.widget.FrameLayout

                            android.widget.ViewAnimator

                                     android.widget.ViewSwitcher

 

已知直接子类

ImageSwitcher, TextSwitcher

 

类概述

在两个视图间转换时显示动画,有一个可以创建这些视图的工厂类。你可以用工厂来创建这些视图,也可以自己创建。一个ViewSwitcher只允许包含两个子视图,且一次仅能显示一个。

(译者注:与ViewFlipper类相似,但该类不常用,常用其两个子类ImageSwitcher:转换图片时增加动画效果; TextSwitcher 转换文字时增加动画效果; 其实例见apidemosImageSwitcher实例和TextSwitcher实例

 

内部类

interface          ViewSwitcher.ViewFactory     

在一个ViewSwitcher里创建视图

 

构造函数

public ViewSwitcher (Context context)

构造一个新的空的视图转换器(ViewSwitcher)

参数

context   应用环境(译者注:应用程序上下文)

 

public ViewSwitcher (Context context, AttributeSet attrs)

构造一个指定上下文、属性集合的空的视图转换器(ViewSwitcher)

参数

context   应用环境(译者注:应用程序上下文)

attrs        属性集合

 

公共方法

public void addView(View child, int index, ViewGroup.LayoutParams params)

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

        参数

child         添加的子视图

index       添加的子视图的索引

params    子视图的布局参数

异常

IllegalStateException       如果切换器中已经包含了两个视图时。

   

public View getNextView ()

返回下一个要显示的视图

返回  

       视图切换之后将要显示出的下一个视图

 

public void reset ()

重置视图转换器(ViewSwitcher)来隐藏所有存在的视图,并使转换器达到一次动画都还没有播放的状态。

 

public void setFactory (ViewSwitcher.ViewFactory factory)

设置用来生成将在视图转换器中切换的两个视图的工厂。也可以调用两次 addView(android.view.View, int, android.view.ViewGroup.LayoutParams)来替代使用工厂的方法。

参数

factory   用来生成转换器内容的视图工厂

 

补充

         文章精选

                   android UI ViewSwitcher的使用(续二)

         Android: Don’t Overlook ViewSwitcher

         Using a ViewSwitcher in your Android xml layouts


上一篇:下一篇: