How to implement a zoom in/out effect on GridView in Android - android

When creating images and texts it is very common to develop a zoom in/out feature in UI, as it haves many applications mainly related to accessibility. In my situation, I'd like to create a customized type of view similar to a gridview, but with the difference that the data is not scrolled but transpassed in front/back directions, so in my case, it is more related to user-experience than accessibility. In this video the described "behavior" is better resumed/defined. I want to create a gridview with this effect, where the previous items can be bring from the "out-screen" to screen and the next items can be bring from the "deep-screen" to the screen, and the gridview itself is static in relation to scrolls. Is it possible? Currently, I'm taking efforts to create it all from scratch using onScrollStateChanged and default zoom implementations through size-scale the data (which is a very harsh solution).
Thanks in advance!

Related

android: How to animate and transition images between two list (or grid) views

I have two gridviews and move images between them on a touch event. I would like to have some transition to show the image moving from one view to the other. Ideally it would appear that the images move across the screen similar to the look of a drag and drop. But instead of the user dragging, I would like the image to move from one view to another on a touch event. But any transition that communicates the idea that the image has moved from one list will do.
I've looked at Scene transitions but the doc says "The framework does not support animating changes to ListView objects, so you should not try to animate them during a transition."
Any sample code from anyone that has done something similar would be appreciated or some guidance to the best approach.

How to create infinite scrollable and zoomable view android?

I am very new to android programming, and I want to create a large infinite scrolling and zoomable activity where I can add views much like the empty activity we get in the Simple Mind app. Which layout and activity type should I use? What we the best way to implement this? Any help or pointers to tutorials are welcome.
No view in Android is infinite, you're going to run out of memory at some point. The solution you choose will depend on how interactive you need the zoomed view to be.
You can check out android pinch zoom for previous discussions on this topic.
If you're just looking at displaying information and not editing then I'd suggest custom tile maps for google maps.
https://developers.google.com/maps/documentation/android/tileoverlay
I've seen it used before for very high resolution viewing of paintings.

Android Game object scrolling

I want to create some kind of a tower defense map using a background image which is fourth as large as the screen of the device (twice horizontal, twice vertical).
my question is, how can I do this best. I'm new to Android, just got some Java basics , and want ti try out some stuff.
I want the user to scroll over the entire map using their finger and want him to zoom in via 2 finger pinch, and of course the objects (towers, sprites) should stay were they are.
I've been searching for hours for now and only found answers like " use Scrollview". I just want a food for thought to get in the right way, maybe with some examples.
You can use ImageView and set appropriate onTouchListener where you will detect pinch-to-zoom gesture using GestureDetector and change view coordinates when user drags the finger.

Reconciling scroll, fling, tap, zoom and pan on the same view in Android

I am working on an application that can read pdf documents and I am trying to implement zooming and panning on a pdf page.
The page is loaded as a bitmap and displayed in an ImageView. There are also some other functionalities already implemented such as navigating the pages in a document with a bottom custom navigation bar that can be scrolled.
Also, the bottom bar appears when the user taps on the page and disappears with the next tap and when flinging, users should be able to navigate to next/previous page in the document.
All functionality such as the scroll, tap and fling is handled by implementing OnGestureListener in the reader activity and I am trying to do the zoom and pan with an OnTouchListener implementation that is set on the ImageView containing the page.
The code seems to work, however it appears that some of the other events, especially the scroll, are interfering with it which makes it slow.
My question is if there is a better way to go about reconciling everything, since the OnGestureListener is used for the GestureDetector's handling of onFling, onTapUp and onScroll, but I can't find a good way to add the zoom/pan code in one of the methods supported by this.
So, if anyone has some experience on handling all these events for one view or some good suggestions/tutorials on this, I would very much appreciate it.
I'm not sure what you mean by 'some other events such as the scroll make it slow', could you elaborate?
You should be able to perform zoom and pan using onTouch fairly trivially, without scrolling being an issue if you choose to use Canvas. Full implementation code can be found at Touch and drag image in android for scrolling, and http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847 for zooming.
It's generally not common to see advanced interactive features applied solely on an ImageView, but that doesn't mean people haven't done it (see How can I get zoom functionality for images? for zoom examples including support for multi-touch or Adding Fling Gesture to an image view - Android ).
Regardless of which way you do it, you'll probably want a GestureDetector in your onTouch function. You should be able to just cut and splice together sections of the tutorials I've linked to in order to get full gesture support + zoom/pan. However, if I were doing it, I would probably just use onTouch with Canvas (since Canvas will give better performance) and use the core MotionEvents such as DOWN MOVE UP for greater control, or if I was feeling lazy, use a GestureDetector for trickier bits like flinging.

Android components for displaying a graph (nodes and edges, in 2D)?

I'm at the starting point of developing an android app similar to a "mindmap" program (like Thinking Space). It shows some graph nodes (containing text, maybe images) and edges that connecting them. I can take care of graph algorithms, but I have two uncertain points about Android components for displaying these things:
The expanded graph will be pretty big, so the user need to be able to scroll both vertically and horizontally. I looked at ScrollView and HorizontalScrollView but they can't scroll both vertically and horizontally. So I hope to know which top level container I should use.
I also want the graph to be zoomable with pinch gestures, so that the user can zoom in to a small part of the graph. But I also want the graph nodes to be interactive, so the user can tap on them, typing text into them and move them with fingers. Should I implement each node as a separate View object? If so, how do I make all the nodes zoom together?
Thanks.
I would definitely rely on custom views for this kind of things, they will give you much more freedom and efficiency than using standard layouts.
Implementing a scrollable view is quite easy, and implementing the pinch gesture will be much easier if you're supporting API >= 8 (see ScaleGestureDetector). Making graph elements interactive and editable would be another thing, though.
Something really much better could be creating a custom layout, that would host editable graph elements (custom views) and draw their relations. It would be much more elegant, clean, expandable, maintainable and reusable, but it would need a lot more designing. Yet I'm sure it would be greatly rewarded.
(This would be quite an ambitious project for me, so... good luck!)

Categories

Resources