简体   繁体   English

Android设置webview宽度以匹配其内容宽度

[英]Android set webview width to match its content width

I have a RecyclerView whose itemview is a WebView , the pages (in fact, just a few words with html tags) I'm gonna show in this WebView has different width, is there any way to make this WebView to match its content width? 我有一个RecyclerView它的itemview是一个WebView ,我要在此WebView显示的页面(实际上只有几个带有html标签的单词)具有不同的宽度,是否有任何方法可以使此WebView与其内容宽度匹配?

Thanks in advance. 提前致谢。

Try this : 尝试这个 :

webview.setWebViewClient(new WebViewClient() {
}

webview.getSettings().setJavaScriptEnabled(true);  
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM