This small n simple library wraps the android ZoomControls class:
http://developer.android.com/reference/android/widget/ZoomControls.html
It provides the 'traditional' zoom controls as seen in the attached screengrab.
ZoomControls
Version: 1.10
ZoomControls is a standard android View so also has all the other standard View methods and properties.
Usage is simple:
Using the android WRAP_CONTENT constant makes the ZoomControls adjust it's size to fit it's 'native' dimensions.
The ZoomControls will not expand if you set a width or height larger than it's native width or height.
But it will clip/shrink in size if you set a smaller than native width or height.
Experiment with the above code and that'll all make sense:
I haven't yet established what the ZoomControls actual native dimensions are - be sure to post those dimensions if you can find them.
Library files and demo project attached.
Martin.
http://developer.android.com/reference/android/widget/ZoomControls.html
It provides the 'traditional' zoom controls as seen in the attached screengrab.
ZoomControls
Version: 1.10
- ZoomControls
Events:- ZoomInClick
- ZoomOutClick
- HasFocus As Boolean
Returns true if this view has or contains focus. - Hide
- Initialize (EventName As String)
- Show
- ZoomInEnabled As Boolean [write only]
- ZoomOutEnabled As Boolean [write only]
- ZoomSpeed As Long [write only]
Sets how fast you get zoom events when the user holds down the zoom in or zoom out buttons.
Default is 1000ms.
ZoomControls is a standard android View so also has all the other standard View methods and properties.
Usage is simple:
B4X:
Sub Process_Globals
End Sub
Sub Globals
Dim ZoomControls1 As ZoomControls
End Sub
Sub Activity_Create(FirstTime As Boolean)
ZoomControls1.Initialize("ZoomControls1")
' using -2 for width and height which is android WRAP_CONTENT constant
Activity.AddView(ZoomControls1, 0, 0, -2, -2)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ZoomControls1_ZoomInClick
ToastMessageShow("Zoom IN", False)
End Sub
Sub ZoomControls1_ZoomOutClick
ToastMessageShow("Zoom OUT", False)
End Sub
Using the android WRAP_CONTENT constant makes the ZoomControls adjust it's size to fit it's 'native' dimensions.
The ZoomControls will not expand if you set a width or height larger than it's native width or height.
But it will clip/shrink in size if you set a smaller than native width or height.
Experiment with the above code and that'll all make sense:
B4X:
' the ZoomControls doesn't expand to 200x150
Activity.AddView(ZoomControls1, 0, 0, 200dip, 150dip)
B4X:
' the ZoomControls shrinks/clips to 96x32
Activity.AddView(ZoomControls1, 0, 0, 96dip, 32dip)
I haven't yet established what the ZoomControls actual native dimensions are - be sure to post those dimensions if you can find them.
Library files and demo project attached.
Martin.
Attachments
Last edited: