title: Android implementation which behaves like browser (zooming/panning)
body: <p>I was wondering if it's possible to create an Android application which behaves the same as any browser on Android phones, including things like:</p>
  
  <ul>
  <li>(Pinch) zooming</li>
  <li>Panning/scrolling</li>
  </ul>
  
  <p><strong>I have tried a couple of things</strong></p>
  
  <ul>
  <li><a href="https://code.google.com/p/android-zoom-view/source/browse/src/pl/polidea/view/ZoomView.java" rel="nofollow noreferrer">ZoomView</a> takes care of the first point, but doesn't work properly when the layout is bigger than the screen (where the scrolling/panning part comes in: the layout gets cut off if outside the screen, and behaves strange when put inside a <code>ScrollView</code>).</li>
  <li>For panning/scrolling I tried a <a href="http://blog.gorges.us/2010/06/android-two-dimensional-scrollview/" rel="nofollow noreferrer">TwoDScrollView</a>, but this one and the above don't get along, much like a normal <code>ScrollView</code>.</li>
  <li><a href="https://stackoverflow.com/questions/10013906/android-zoom-in-out-relativelayout-with-spread-pinch">ZoomableRelativeLayout</a> does work, even pinching is implemented, but this works only with images. The clickable area, for example, does not shift when zoomed/panned. So that was also a no-go.</li>
  </ul>
  
  <p><strong>Alternative</strong></p>
  
  <ul>
  <li>Using a <code>WebView</code>/<code>PhoneGap</code>, but I'm really no expert in <code>HTML(5)</code> or <code>JavaScript</code>.</li>
  </ul>
  
  <p><strong>Question</strong></p>
  
  <ul>
  <li>What is the best approach if I have a layout, which can be bigger than the screen, and make it fully zoomable and pannable, preferrably native?</li>
  </ul>
  
  <p><strong>Posts I've read</strong></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/9192424/zoom-content-in-a-relativelayout">Zoom Content in a RelativeLayout</a></li>
  <li><a href="http://developer.android.com/training/animation/zoom.html" rel="nofollow noreferrer">Android dev zoom animation</a></li>
  <li><a href="http://myandroidnote.blogspot.nl/2011/03/zooming-view-completely.html" rel="nofollow noreferrer">Blog about zooming a view completely</a></li>
  <li><a href="https://stackoverflow.com/questions/14254076/wiki-about-android-zoom-view-jar">Wiki about android-zoom-view.jar</a></li>
  <li><a href="http://code.cheesydesign.com/?p=723" rel="nofollow noreferrer">Java Pan / Zoom listener for Android</a></li>
  <li><a href="https://stackoverflow.com/questions/5375817/android-pinch-zoom/5376108#5376108">android pinch zoom</a></li>
  <li>Other posts about this subject, however, no answer has solved my problem as of yet.</li>
  </ul>
  
  <p><strong>Current implementation and drawbacks</strong></p>
  
  <pre><code>View zoomableLayout = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.actuallayout, null, false);
  zoomableLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
  
  zoomView = new ZoomView(this);
  zoomView.addView(zoomableLayout);
  LinearLayout main_container = (LinearLayout) findViewById(R.id.main_container);
  main_container.addView(zoomView);   
  </code></pre>
  
  <p>This works quite nice, as long as the unzoomed layout fits the screen. Once it gets bigger, and I need to implement a <code>ScrollView</code>, the functionality is not as hoped or as expected. For example, if I scroll down, and zoom in, I can't scroll all the way up, only to what was visible when I zoomed in.</p>