在web视图Android 2.3的希伯来文字体 [英] Android 2.3 Hebrew fonts in Webview

查看:113
本文介绍了在web视图Android 2.3的希伯来文字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我移植,显示希伯来至Android 2.3的应用程序。 2.3模拟器正确显示字符串一个TextView的时候,但是当我尝试把字符串中的WebView,web视图只显示乱码。

I am porting an app that displays Hebrew to Android 2.3. The 2.3 emulator displays the strings correctly when in a TextView, but when I try to put the strings in a WebView, the webview just displays gibberish.

这告诉我,希伯来文字体都可以在模拟器,但web视图code有一些人失踪。

This tells me that the Hebrew fonts are available in the emulator but the webview code has something missing.

这是code:

     WebView mWebView = (WebView) findViewById(R.id.webview);
     mWebView.loadData("<html><body>"+temp1 +"</body></html>",
            "text/html", "UTF-8");

如何让模拟器正确显示的WebView任何想法。

Any ideas on how to get the emulator to display the webview correctly.

推荐答案

当你展示,你是不是给了浏览器知道你的页面使用从右到左的脚本的方式在页面

When you display the page, you aren't giving a way for the browser to know that your page uses a right-to-left script.

您可以使用HTML DIR 在围绕你的从右到左文本标记元素属性(它应该自动检测扭转哪些字符,并且不)。 (更多详情,请看从W3C本说明 - 它似乎在Chrome中至少实现)

You can use the HTML dir attribute in a markup element that surrounds your right-to-left text (it should detect automatically which characters to reverse, and which not to). (For more details, look at this note from W3C - it seems to be implemented in Chrome at least.)

可能是最方便的方法是第一个标记为改写:

Probably the most expedient way would be to rewrite the first tag as:

<html dir="rtl">

这篇关于在web视图Android 2.3的希伯来文字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆