How to zoom normal views in Android - android

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?

Related

Panning a layout with imageviews on it

I have been puzzled by how to approach this for a while. I have Framelayout with over 20 image views on it. I want to be able to pan the framelayout. Basically, touching and dragging causes the background image to pan (and the 20 image views to move along).
This is similar to what strategy games do (you have map and buildings).
I read all about panning and zooming and they all talking about doing this for single imageview. In my case, not only it is a layout but also it has other views.
How do I approach this? Any pointers ?
Thanks
I have a github project for zooming and panning although its for View Groups it would be easy to change for a View.
Check it out let me know if you have a question it is unfinished but works.
https://github.com/Xjasz/AndroidZoomableViewGroup
Copy the class and extends FrameLayout instead of ListView.
Then make sure in your XML to use the class instead of a FrameLayout.
You could have a TouchInterceptor/Custom view where on touch, you offset the view from its parent by the delta of the current touch coords from the last touch coords.

Android Horizontal Zoom in LinearLayout?

Hi I have a one LinearLayout that would be contain some other views. I would like to have the ability to zoomIn and zoomOut(ONLY HORIZONTAL ZOOM OUT/IN) on the actual LinearLayout as a whole. Is there a way to do that?
Here am use screen shorts once look at this.
1)This IS general Image
NOTE: Without Effecting remaining viws
On touch zoom of View is described in documentation. And if you like zoom on gesture, i think this post be useful.

Android : GridView Zoom

I have two gridviews, they contains my custom views as their children. I have implemented a drag and drop functionality to drag a view from one grid to another. What I want to achieve now is when I drop my view on the main GameBoard grid, I want the Grid to Zoom automatically. I also want to implement Pinch zoom so that user can zoom in/out the grid by himself also. Is there any way to achieve this?
I have tried to increase the gridview column height and width dynamically, but it is not working out, please suggest me a way to do this.
Thanks.
I have dig out a lot after solving this, but I end up in a black hole. Revised entire game to remove the GridView and use basic Canvas to achieve all the functionality. Hope this helps someone.
Thanks

Get WebView controls for a View?

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.

Did a layout with many ui controls can support pinch and zoom gestures

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

Categories

Resources