Zoom a view over layout in android

倖福魔咒の 提交于 2019-12-08 12:28:39

问题


How to make zoomable LinearLayout?

I used this to zoom my layout this worked for click to zoom and not for pinch to zoom and also i want to zoom a view over this layout. That view is returned by canvas method that is used to draw a line over this layout. Now my layout is zooming and not the canvas element. Can someone help me to zoom both the canvas element and the layout. Thanks in advance buddy.


回答1:


This Answer is to zoom image and content made to load in webview

Copy an Image in Assets and create a file image.html in assets the code will be some what like this

<html>
  <table>
    <tr>
      <td>
        <img src="droid.jpg"  width="304" height="228" alt="Hello">
      </td>
    </tr>
  </table>
</html>

and write the below code in java class

public class MainActivity extends Activity {
    // declare a WebView object first
    WebView mWebView = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        // load view
        mWebView = (WebView)findViewById(R.id.webView);
        // (*) this line make uses of the Zoom control
        mWebView.getSettings().setBuiltInZoomControls(true);
        // simply, just load an image
        mWebView.loadUrl("file:///android_asset/image.html");
    }
}

if you want some other option you can go to this link good luck :)



来源:https://stackoverflow.com/questions/18508850/zoom-a-view-over-layout-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!