use*_*159 5 android text-align webview
如何在webview中将文本方向更改为从右到左?
这是我的代码
WebView web = (WebView) findViewById(R.id.web);
web.getSettings().setJavaScriptEnabled(true);
web.loadDataWithBaseURL("", myhtml, "text/html", "UTF-8", "");
Run Code Online (Sandbox Code Playgroud)
小智 15
我认为您需要更改HTML代码中的dir ="RTL.例如:
<body dir="rtl">
<p>Some Text that will be RTL aligned</p>
</body>
Run Code Online (Sandbox Code Playgroud)
WebView只允许您查看网页,但不会更改文本方向.这仅取决于网页中的HTML标记.
如果它仍然无效,您的HTML可能会出现问题.您可以在此处分享您的代码,我可以尝试进一步帮助您.
汤姆.
sir*_*gid 13
它适合我:
desc.loadDataWithBaseURL("http://www.atfonline.ir/", "<html dir=\"rtl\" lang=\"\"><body>" + outhtml + "</body></html>", "text/html", "UTF-8", null);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4146 次 |
| 最近记录: |