Displaying inverse numbers when loading Hebrew rss with android ...
I'm Loading an Hebrew (rtl) xml feed with xml Dom using eclipse android environment.
When displaying the feed on TextView text is OK but numbers Displaying inverse
for example :
if fee开发者_JAVA百科d (XML) contain 007 it WILL displayed as 700..
I'm re-posting my own answer:
"Try presenting your text in a webkit control, its RTL support works fine, as long as the HTML code is tagged appropriately."
Hope that helps you too.
Android doesn't officially support RTL languages.
Have a look here: Android: RTL support - digits embedded in a right to left sentence (Hebrew)
I don't have enough rep to reply to the comments on @Vitalyb's answer, but I have used this solution and it works great. You just need to use a webview, and load it with html text. There are plenty of code samples available on the Android dev sites.
my final solution was:
add a charset=utf-8
public static String BuildHtml(String _HtmlString)
{
StringBuilder sb = new StringBuilder();
sb.append("<html>");
sb.append("<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=utf-8\">");
sb.append("<body style=\"direction:rtl;\">");
sb.append(_HtmlString.trim());
sb.append("</body>");
sb.append("</html>");
return sb.toString();
}
then calling it just before loadData..
myWebview.loadData(BuildHtml(mytext), "text/html", "utf-8");
I will glad to hear about (light) simple solution then that,for using a TextView instead of WebView..
thanks
http://www.wave-site.com/
精彩评论