Tag Archives: touch

Multitouch Panning and Zooming Examples for Android

I have done some work so I better understand multitouch features in Android. I built a simple demo with examples of pinch zooming and panning. Most of the examples involve using drawing operations on the canvas of a view.
About two years ago, I started some work on moving images in Android. I started with the “Making Sense of Multitouch” blog article and ended up doing some simple things with moving images and then drag-drop based on the Android Launcher (see references for links). It’s interesting to me that I have gone back to that same article for a different purpose. I am working on apps where the basic zoom and pan operations are needed. Continue reading

Advertisements
Posted in Android | Tagged , , , , | 35 Comments

Android Images With Clickable Areas – Part 1

I want to display images in Android and have different clickable regions within the image. I have read about two different ways of doing this. The first is a bit like image maps in HTML. You define areas on the screen, using a list of coordinates, and connect the areas to actions. The second method involves overlaying a hotspot image on top of the real image being displayed. The overlay image has exactly the same size as the first image. It uses different colored regions to indicate the hotspots. When the user clicks on the primary image, code runs to check the pixel at the corresponding point in the hotspot image. In this, the first of two articles about image maps in Android, I will explain what I learned for the second technique. Full source code is provided for this sample app.
Continue reading

Posted in Android | Tagged , , , , | 91 Comments

Moving Views In Android – Part 3, Drop Zones

Part 3 of my “Moving Views in Android” notes covers the drop side of drag-drop. It shows you how you can different behaviors associated with different areas of the screen. Continue reading

Posted in Android | Tagged , , , | 100 Comments

Moving Views In Android – Part 2, Drag and Drop

This is part 2 of my investigation into how to get views on an Android screen that a user can move by touching them and dragging them. For Moving Views in Android – Part 1, I had a couple of images positioned on the screen and got the images to move on the screen. It turns out that the views themselves were not moving, just the images within the bounds of the view. In the work that I describe here, I actually have the views moving. The key was to have a custom ViewGroup to coordinate drag and drop events for all views within the layout. Continue reading

Posted in Android | Tagged , , , , | 163 Comments

Moving Views in Android – Part 1

I am building an Android app where I want to have a lot of views on the screen and allow the user to move them around by touching and dragging them. So far, I have learned enough about Androide touch events to get a view to move when it is touched. I’ve also learned how to hide and show views. Continue reading

Posted in Android | Tagged , , | 9 Comments