我正在使用Android中的WebView来显示条款和条件,但是问题是我需要为阿拉伯语提供应用程序支持。在这里,它需要将文本方向向右到左(RTL(。但是我遵循了很多方法来解决这个问题。您能检查一下方式并建议我一次吗?
处理一个
private String mUrl="terms_conditions_url";
WebView webview=findViewById(R.id.web_view);
if(ltrDirection){
/** 对于LTR文本 */
webView.loadData(mUrl);
}else{
/** 对于RTL文本 */
mWebView.loadDataWithBaseURL(mURL,"<html><body dir="rtl"></body></html>", "text/html", "UTF-8", null);
}
处理两个而且我也跟随另一个方式,就像..,
private String mUrl="terms_conditions_url";
WebView webview=findViewById(R.id.web_view);
if(ltrDirection){
/** 对于LTR文本 */
webView.loadData(mUrl);
}else{
/** 对于RTL文本 */
mWebView.loadDataWithBaseURL(mURL,"<html dir="rtl"></html>", "text/html", "UTF-8", null);
}
,但对我没有任何帮助。
请给我最好的代码。
使用此代码!更新!
WebView wv;
String outhtml = "Terms and Condition are as follows....your strings";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
wv = (WebView) findViewById(R.id.web_test);
wv.loadDataWithBaseURL(mURL, "<html dir="rtl" lang=""><body>" + outhtml + "</body></html>", "text/html", "UTF-8", null);