目录搜索
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
文字

ZoomButton

农民伯伯

版本:Android 2.2

 

public class ZoomButton extends ImageButton implements View.OnLongClickListener

 

java.lang.Object

android.view.View

       android.widget.ImageView

              android.widget.ImageButton

                     android.widget.ZoomButton

 

概述

        

         缩放按钮,实际上是很普通的两个按钮,可以简单的理解为一个ImageButton加上一张缩放的图标。如下代码:

 

公共方法       

         public boolean dispatchUnhandledMove (View focused, int direction)

         对于获得焦点的View,这个方法是捕获箭头事件最后的机会。这就是在获取焦点的View没有在内部处理、系统在要求的方向也不能找到一个新的View让其获得焦点时调用。

                   参数

                            focused   当前焦点View

                            direction焦点移动的方向。其中之一:FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT FOCUS_RIGHT.

                   返回值

                            如果为true,将清除这个View未处理的事件。

         (注:从源码中可看出ZoomButton覆盖了父类的该方法,在super之前调用了一下clearFocus,如下代码:

 

         public boolean onKeyUp (int keyCode, KeyEvent event)

         默认实现至KeyEvent.Callback.onKeyMultiple() :当点击执行时KEYCODE_DPAD_CENTER KEYCODE_ENTER被释放。

                   参数

                            keyCode 按下按钮代表的键值,属于KeyEvent (注:KeyEvent的静态属性)

                            event       KeyEvent对象,定义按钮动作

                   返回值

                            如果您处理这一事件中,返回true如果你想允许事件被下一个接收器处理,返回false

                           

         public boolean onLongClick (View v)

         当一个View被长按时调用。

                   参数

                            v      被长按的View

                   返回值

                            如果返回true,这个回调在长按时被执行了,反之返回false.

 

         public boolean onTouchEvent (MotionEvent event)

         实现这个方法处理触摸屏移动事件。

                   参数

                            event       该移动事件.

                   返回值

                            如果是true,该事件是触摸,反之返回false

 

         public void setEnabled (boolean enabled)

         设置这个View启用状态。

                   参数

                            enabled 设置true表示启用,反之表示禁用。

 

         public void setZoomSpeed (long speed)

         (注:单独使用无实际意义,可以用来存放临时数据)


上一篇:下一篇: