Android WebView or ImageView?

心已入冬 提交于 2019-12-01 10:59:46

Set the image elements width to 100% via CSS, height should scale according to the aspect/ratio of the image.

I have not tried this yet. But from your question i can see that the only probelm you face using webview is the screen size fit problem. To overcome this, you can simply set the initial scale level to 1 and your Image should fit inside of the screen.

Try this,

     <WebView  
      android:id="@+id/webview"
      android:layout_width="50dip" 
      android:layout_height="50dip"/>

webView.setInitialScale(1);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);

NOTE: i am not sure how far this will be effective. I haven't tried this yet. But giving a try is worth it.

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