Preface
This chapter translates android. widget. zoombutton, translated as a scaling button, has little practical significance. Google cannot find several examples of applications, but it is posted here for the integrity of the entire API documentation. More translators are welcome to participate in the Chinese translation operation of Android APIs! My mailbox over140@gmail.com.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog: http://www.cnblogs.com
Farmer's uncle: http://www.cnblogs.com/over140/
Body
I. Class Structure
Java. Lang. Object
Android. View. View
Android. widget. imageview
Android. widget. imagebutton
Android. widget. zoombutton
Public class zoombutton extends imagebutton implements view. onlongclicklistener
Ii. Overview
The zoom button is actually a very common two buttons, which can be simply understood as an imagebutton plus a zoom icon. The following code:
Iii. Public Methods
Public Boolean dispatchunhandledmove (view focused, int direction)
This method is the final opportunity to capture arrow events for a view with focus. This is called when the view that gets the focus is not processed internally and the system cannot find a new view in the required direction for it to get the focus.
Parameters
Focused current focus View
The direction in which the direction focus is moved. One of them: focus_up, focus_down, focus_left and focus_right.
Return Value
If this parameter is set to true, events not processed by this view are cleared.
(Note: we can see from the source code that zoombutton overwrites the method of the parent class and calls clearfocus before Super, as shown in the following code:
Public Boolean onkeyup (INT keycode, keyevent event)
Implemented by default to keyevent. Callback. onkeymultiple (): When you click Run, keycode_dpad_center or keycode_enter are released.
Parameters
The key value represented by pressing the keycode button, which belongs to keyevent (Note: static attribute of keyevent ).
Event: The keyevent object that defines the button action.
Return Value
If you are processing this event, true is returned. If you want to allow the event to be processed by the next receiver, false is returned.
Public Boolean onlongclick (view V)
When a view is called on time.
Parameters
V is a long-pressed view.
Return Value
If true is returned, the callback is executed on time and vice versa.
Public Boolean ontouchevent (motionevent event)
This method is used to handle touch screen mobile events.
Parameters
Event.
Return Value
If it is true, the event is a touch, and vice versa, false is returned.
Public void setenabled (Boolean enabled)
Set the enabled status of this view.
Parameters
If enabled is set to true, enable is enabled, and vice versa.
Public void setzoomspeed (long speed)
(Note: it has no practical significance to use it separately and can be used to store temporary data)
4. Download
Code:/files/over140/2010/9/magnify.rar
PDF: http://download.csdn.net/source/2727796
V. Series
Android2.2 API Chinese Document Series (1) -- textview
Android2.2 API Chinese Document Series (2) -- edittext
Android2.2 API Chinese Document Series (3) -- accessibilityservice
Android2.2 API Chinese Document Series (4) -- manifest
Android2.2 API Chinese Document Series (5) -- View
Android2.2 API Chinese Document Series (6) -- imageview
Android2.2 API Chinese Document Series (7) -- imagebutton
Android2.2 API Chinese Document Series (8) -- quickcontactbadge
End
Thanks to Shi for assisting in the translation of this chapter. In addition, we have two translators yesterday and today. I have five developers working on Android API translation, I am the only one here to force myself to write articles every Monday. The translation speed is limited. I once again appeal to more friends to join me !! No matter how good your English is, even with the help of translation tools, as long as you translate with your heart, at least you can understand and understand the supplementary content and code, you can help everyone, therefore, such articles and translations are valuable. We sincerely hope you will join us!