title: Android webview how to scale to fit if content too large, but show actual size when content smaller than screen?
body: <p>I am writing an app which one of the features is to show image from our web server.
  The images from web server is in varying size. It will be displayed in the center of screen.
  When the image is larger than screen size, it will be resize to fit the screen and user can pinch to to zoom.
  When the image is smaller than screen size, it will not be resized. </p>
  
  <p>What I tried: I have tried to implement a custom imageView to allow zooming but it seems that many calculation is required. 
  Then I find many programmer do this by a webview. </p>
  
  <p>Now it can be zoomed, and is placed in center of screen. The problem is when the image is smaller than screen size, it also displayed fit screen.</p>
  
  <p>Question, is there any method the get the inner width of image size, so that I can use this to determine the scale of image? or is there better way to achieve this? </p>
  
  <p>Below are the code I used, thanks very much!</p>
  
  <pre><code>        final String html = "&lt;body bgcolor=black&gt;"
                  + "&lt;table width=100% height=100%&gt;&lt;tr&gt;&lt;td&gt;&lt;center&gt;&lt;img src=\""
                  + userProfile.getImageUrl()
                  + "\"  width=100% /&gt;&lt;/center&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;" + "&lt;/body&gt;";
  
          WebSettings settings = mWebView.getSettings();
          settings.setBuiltInZoomControls(true);
          settings.setSupportZoom(true);
          settings.setUseWideViewPort(true);
          settings.setLightTouchEnabled(true);
          settings.setLoadWithOverviewMode(true); 
  
          mWebView.loadDataWithBaseURL("fake://not/needed", html, "text/html",
                  "utf-8", "");
  </code></pre>