農民のためのアンドロイド情報アプリを開発しています。情報はインドの言語で提供されます。私はその目的でwebviewを使用しています。情報はhtmlファイルに保存されています。現地語で書かれた情報が見えないということです。これを解決するにはどうすればいいですか?androidのwebviewのローカル言語でローカルHTMLファイルを読み込み
WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Getting reference to WebView of the activity_main layout
mWebView = (WebView) findViewById(R.id.webview);
// Loading an html page into webview
mWebView.loadUrl("file:///android_asset/text.html");
}
活動の主
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res /android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_world" />
</RelativeLayout>
htmlファイル
<html>
<head>
<meta http-equiv="content-type" content="text/html;" charset="UTF-8">
<style>
/** Specify a font named "MyFont",
and specify the URL where it can be found: */
@font-face {
font-family: "MyFont";
src: url('file:///android_asset/b.ttf');
}
h3 { font-family:"MyFont"}
</style>
</head>
<body>
<h3>
ಪ್ರಶಾಂತ
</h3>
</body>
ストア言語を示すxyは、en'、 '' in'のようなもの... 2文字短いです 'テキストxy.html'のようなあなたのファイル。次に、現在のロケールに基づいて、対応するファイルをロードします。 –