在android中的Webview中显示Gujarati语言

时间:2012-08-14 08:10:14

标签: android android-emulator android-widget

我想建立显示故事的应用程序,其中故事名称 storycontent 应该以古吉拉特语显示。

我使用过 Shruti.ttf 字体

对于 storyname ,我使用了textview,对于 storycontent ,我使用了webview

Typeface font = Typeface.createFromAsset(this.getAssets(), "shruti.ttf");
poetryTitleText.setTypeface(font);
poetryTitleText.setText("Snow White");

并且效果很好。

但是为了在webview中显示 storycontent ,我使用了HTML页面并在HTML的<style>标签中设置了字体名称。但它显示方形图标。

模拟器不会以古吉拉特语显示字体。即使我从 R.string 文件发送古吉拉特语字符串。

帮助我。

提前致谢

1 个答案:

答案 0 :(得分:0)

- 我找到了2个解决方案,我不确定是否有用,但你可以尝试一下

1.)使用Textview代替webview

Html.fromHtml(username + " shared "
                    + "<font color=\"#47C4E3\">" + objnews.news_title
                    + "</font>");

- 将此代码设置为Textview.settext(..代码..)

2.)使用代码设置webview的jeader: -

Map<String, String> headers = new HashMap<String, String>(); headers.put("Accept-Language", "Your fonts"); mWebView.loadUrl("http://developer.android.com", headers);

-Thanks!请告诉我这是否是你想要的正确道路?