directory search
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
characters

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)

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


Previous article: Next article: