0

In my case I have RelativeLayout which contains many EditText boxes and lines between them. What I need now is to get Zoom work on this. I have googled a lot(in days) and I haven't found the answer how to do this.

Firstly it would be easiest to all of us if I start with few questions, so:

  1. Is that true 'Pinch zoom' is only supported on ImageView, MapView and WebView?
  2. Is it even possible to get any kinda zoom work on RelativeLayout? (I know one and imo last choice is to use buttons and multiple all size values and/or refactor whole "view" every time button is touched)
  3. If it is possible to make work in anyway easier than above I would love to hear how it should be done.

Edit: And I tried to use Animation and there was some kind of scale which worked pretty well, but the only and fatal problem was that EditTextBoxe's Touching bounds didn't scale.. Or even move, so they were on original position and size. Is there any suggestions to this one?

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
lehtu
  • 868
  • 1
  • 12
  • 27

2 Answers2

1

RelativelyLayout doesn't even zoom at all. Or scroll. You are looking in the wrong place. You would need to put your view hierarchy in a container that does this. If it is going to zoom, it will be tricky because the container will need to apply a scale factor to both the drawing and touch events going through it.

hackbod
  • 90,665
  • 16
  • 140
  • 154
  • Do you have any suggestions what I should use then? What container does have pinch zoom and same time it can handle zooming on editText boxes correctly? – lehtu Jun 20 '11 at 20:09
  • 1
    There are no standard containers in the platform that implement pinch-zoom. You will need to implement this yourself. Typically applications that do this (Browser, Maps, Gallery) have their own custom View in which they do all of their drawing so the pinch zoom is intimately tied in to that view's custom rendering and event processing. You could try doing something generic in a ViewGroup container that applies a 2d transformation to the Canvas and MotionEvents going down to its children, though I don't know how satisfactory the result of this may be. – hackbod Jun 23 '11 at 13:39
0

You should look at http://code.google.com/p/android-pinch/source/browse/#svn%2Ftrunk%2Fsrc%2Fcom%2Fnikkoaiello%2Fmobile%2Fandroid%253Fstate%253Dclosed for a couple of implementations if you haven't already: I get the sense that you are right and those 3 are the only Views for which there is any native support for the pinch zoom metaphor.

As far as the bounds not scaling without more knowledge about the animations you are using that appears to be a common problem: does overriding the animation and setting http://developer.android.com/reference/android/view/animation/Animation.html#willChangeBounds%28%29 to return true help in any way?

Femi
  • 64,273
  • 8
  • 118
  • 148
  • For first one, I thought something like that.. Second one, Im not sure what that does.. have to try it thanks! – lehtu Jun 20 '11 at 20:13