Sorry about the poor title - it's hard to summarize the issue in one line. I'm working on a map tiling system for small-scale maps (imagine building interiors), with zoom and pan functionality. Most of this is working properly, but after a scale operation I try to limit the scrollable area using LayoutParams and think I'm doing it wrong, as the behavior is unpredictable (to me, at least).
There's a "main" container (FrameLayout). On the top layer are the controls and other elements that don't move or scale. The bottom layer is another a FrameLayout with scrolling enabled on both axes (a slightly modified version of http://blog.gorges.us/2010/06/android-two-dimensional-scrollview/). This layer has 2 layers - an ImageView that displays a low-res version of the map on bottom, and another FrameLayout with a "grid" of ImageView tiles positioned with top/leftMargin. Tiles are rendered on-demand based on what tiles would be visible (on screen), so the low-res bottom layer is visible when scrolling or zooming (before the final viewable area is calculated and the appropriate tiles are rendered). Markers and other elements are contained in another FrameLayout in the scrollable View, above the one that has the 2 map layers (which scale, together) So the heirarchy looks like this: main container --------scrollable layer ----------------maps layer ------------------------low-res image ------------------------tile container ----------------markers layer --------controls layer During a pinch event, I "zoom" the maps layer (inclusive) by overriding onDraw and using canvas.scale, and maintain scroll position using getFocusX/Y. This all works fine. The issue is that I need to re-assign the total scrollable width and height of the scrollable layer, so that scrolling stops at the edge of the (scaled) maps. Initially this works properly, but after a scale operation everything goes haywire. I've tried using LayoutParams(originalMapWidth * scale, originalMapHeight * scale) on every possible combination of the layers to be affected (scrollable, maps, low-res, tiles), but it never lays out correctly - the closest I've gotten is that the width does get properly constrained by the height does not. If I just apply the new LayoutParams to the maps layer, clipping occurs (it looks like the scale factor is being applied twice - this appears to be a red herring and I tried to compensate with simple math (dividing the width/height by the scale, etc) and it never got to a usable point. In looking at the source of the one 3rd-party component I'm using (the 2D scrollview linked above), it looks like the issue might be in there, but my attempts to force it to work with my setup have failed, and I'm not eager to tackle recreating that feature (but I will if I have to). I've got a fairly slimmed down version where I'm trying to target just this issue (no controls, no markers, a single tile set, etc), but it's still pretty long and didn't seem appropriate for a post, but I'm glad to share whatever code would be helpful. Am I missing something obvious about how layouts work? I've been beating up on this one (seeming small) issue for days now, and am making no progress. Any insight would be very much appreciated. TYIA -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

