Android : GridView Zoom - android

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

Related

think my Android app needs a pinch zoom and pan LAYOUT

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)

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.

Endless horizontally scrolling view to draw content dynamically

I want to create the following view / set of views which behave following way:
I have huge set of points which have been stored to DB in web server.
My client application downloads those and should draw curved lines about the data.
What components should I use here to get this "infinite" scrolling view to draw content dynamically.
No snapping wanted, so it should be smooth and can stop to every X position.
Should I proceed with this by using HorizontalScrollView with horizontal LinearLayout and remove/add views based on scrolling, then translate the scrolling position and provide fling that the scrolling doesn't stop suddenly.
Or is just one canvas possible to use and draw the content to simulate the scrolling?
Maybe a horizontally scrolling ListView component?
The solution should be efficient and use minimum of memory.
Which solution do you recommend, or do you have some new ideas other than above?
All suggestions are highly appreciated. Thanks.
There is several possibilities:
Create custom View class and implement GestureDetector there. You can get movement of finger, calculate currently visible area and draw only visible part of content.
May be this solution is not the easiest to implement, but it will be fast and does not require any resources.

How can I add a Button to a custom scrolling and zooming SurfaceView?

I wanted to add a custom ImageButton on top of my SurfaceView so it essentially scrolls with the View. The canvas scrolls and zooms with a matrix. How could I go about doing this? Thanks.
Assuming I understand the question correctly, can you not just do button.draw(canvas) in your SurfaceView.onDraw() method? You definitely want to bypass the normal layout engine (because it's terribly slow for moving things around) so you'll also have to fake up hit-detection etc.

Categories

Resources