【问题标题】:Display hindi html in android webview在 android webview 中显示印地语 html
【发布时间】:2012-01-18 07:30:14
【问题描述】:

我正在制作一个应用程序,我必须在其中显示以 html 形式出现的 hindi 文本,这意味着我必须显示整个 html 页面,其内容为 hindi.Can任何人都可以帮助我。任何帮助将不胜感激。我的代码如下:

public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            myWebView = (WebView) findViewById(R.id.webview);

           myWebView.loadUrl("file:///android_asset/test.html");

           WebSettings webSettings = myWebView.getSettings();
            webSettings.setJavaScriptEnabled(true);

html文件如下:

<html>
   <head>
        <meta charset="ISO-8859-1">

    <title>New test</title>
  </head>

<body>
   <body>

 <p>
 &#2325;&#2375;&#2357;&#2354; &#2313;&#2344; &#2357;&#2381;&#2351;&#2325;&#2381;&#2340;&#2367;&#2351;&#2379;&#2306; &#2325;&#2375; &#2346;&#2366;&#2340;&#2381;&#2352; &#2361;&#2376;&#2306; &#2332;&#2379; &#2361;&#2367;&#2344;&#2381;&#2342;&#2368; &#2325;&#2375; &#2360;&#2366;&#2341; &#49;&#48; &#2357;&#2368;&#2306; &#2325;&#2325;&#2381;&#2359;&#2366; &#2313;&#2340;&#2381;&#2340;&#2368;&#2352;&#2381;&#2339; &#2325;&#2368; &#2361;&#2376;


 </p>

【问题讨论】:

标签: android html hindi


【解决方案1】:

如果您有文本文件,请将文件复制到资产文件夹中。 然后从 assets 中读取它并使用 Webview 显示内容。

webview.loadUrl("file:///android_asset/hinditext.html");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-28
    相关资源
    最近更新 更多