After working with WebView for a while, and then moving back to standard Views, zooming and scrolling seems quite complicated. Are there any ways of using the same zoom and scrollcontrols for any View group, (builtInZoomControls, Horizontal and Vertical Scrollbar, Double tap to zoom out and pinch zooming) or are there any workarounds like an SDK or jar. file that will make this possible?
zooming and scrolling seems quite complicated
Scrolling is a matter of using widgets that know how to scroll (e.g., ListView) or wrapping other widgets and containers in a ScrollView or HorizontalScrollView.
Zooming is not normally done except in fairly targeted circumstances (e.g., zooming an image, zooming a map).
Are there any ways of using the same zoom and scrollcontrols for any View group
For "scrollcontrols", see above.
There are a few open source classes floating around for zooming an image. Zooming a map is built into MapView.
Related
So. Iv'e got a straight forward relative layout which I add multiple ImageViews to.
I don't want the images to obscure each other so as they are added they are translated so they don't.
As more ImageViews are added they need to be translated further and further away from the centre of the layout so as not to overlap other images and so they fall off the edge of the user's screen - no problem so far ...
I need to give the user the ability to pan to see the images that are off screen and also zoom in and out (with gestures not buttons) to see all images or focus in on one.
I think the solution to this problem is to modify the layout to allow pinch and pan but all I can find is how to create views that support pinch and pan.
I need each image to be in a separate ImageView.
Forgive me if this is the wrong way to come at this problem but any help would be much appreciated.
This might help explain:
want to scroll about and zoom around this layout (click to see)
In my android app, I have a linearlayout where I put many linearlayouts with images in it. It will go past the screen border horizontally and vertically.
I want the user to pinch zoom in or out and pan around. I tried putting it in a horizontal scroll and vertical scroll, but it wont let me zoom, and I can only move in 1 direction at 1 time, like it wont let me move diagonally.
I tried this plugin
https://code.google.com/p/android-zoom-view/downloads/list
But it won't let me pan around. It only lets me do it on the stuff thats visible on the screen...
Does anyone know how to make this work?
Thanks
The easiest way I can think of is to put your images in HTML and use webview to display it.Webview automatically handles zooming and panning of content.
In my application, I would like to add zoom functionality to my views. Like in an activity I am displaying LinearLayout etc. But as of now what I know a view can be zoomed in only in WebView and not in normal view. After all what I want is to zoom in/zoom out feature similar to WebView in my normal views.
Thanks in advance.
Construct a Custom Layout extending Liner Layout or any other. Override its onDraw function and and provide zooming functionality manually. There are many example at SO for zooming. You can follow them..
This might help:
android pinch zoom
How to apply pinch zoom on Gallery in android?
I need apply pinch and zoom gestures for my complete view.
In my view there are a lot of controls like textviews, buttons, list view and all. This all have different listeners. I need to apply zoom to this without affecting the my UI controls and listeners.
I know how to zoom a image and using a webview. But how we apply zoom to complete layout with different controls and listeners ?
(I'm working on honeycomb)
At last i got the solution. We can use setScalaX and setScaleY with pivot point
I have explained it here
Zooming a view completely
Pinch Zoom to view completely
Im not aware of anything that will simply take care of this. All I can say is that I've known others to achieve this by applying a translation matrix to a route view group which then applies to it's children's views (if I remember correctly).
From this the touch events were converted to apply to the translated view.
To handle the pinch to zoom this may be of use: Android Dev - OnScaleGestureListener
I noticed that the position of the builtInZoomControls in WebView (bottom, horizontal right) is not consistent with the default position in the MapView (bottom, horizontal center).
1) Why is that not consistent? (Probably a question to be asked to Google)
2) Is there a way to horizontal center the builtInZoomControls of the WebView without applying custom Zoom controls? Or is that the only way?
From my experience with the Android UI, here's what i've noticed
When using a Maps activity, there is really no reason to align to the right, you are looking at a map, ie. a 2D surface that can be scrolled at will.
When browsing a website, most content starts at the left and runs right.
So, placing the control in the lower right while browsing the web makes a lot of sense, to keep it out of the way, when using maps (where the zoom control is more important), the control should be more prominent, thus in the center, where it still does not get in the way here.
Upon first reading your post, I was going to suggest using a custom zoom control, but I realize that you have thought about this already. If having centered controls is essential to your application, a custom control seems to be the route I'd take.
When viewing maps in a WebView you are actually using the Browser app to view the Map Tiles. In order to change the zoom controls when in Web View you would have to manipulate the zoom controls of the browser being used to view the Map Tiles.
You should try manipulating the WebView zoom controls and not the MapView zoom controls.