Saeid Saeid - 4 years ago 278
Android Question

webview justify not show Persia(Farsi)/RTL Language Correctly

i need to make justify for webview to show Persian(Farsi)/RTL String.

i use below code :

String text = "<html><body>"
+ "<p align=\"justify\">"
+ getString(R.string.test1)
+ "</p> "
+ "</body></html>";
webView.loadData(text, "text/html", "utf-8");

but webview can't show persian character - below image :

enter image description here

what i to do?

Answer Source

Ok , Finally i found a good way to make justify + using "\n" + all other customize for String.

  1. i make a HTML file contain customized string
  2. Load data to WebView to thisway :


Edit :

webView.loadDataWithBaseURL(null, yourString, "text/html", "utf-8", null);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download