2011-04-18 22 views
7

泰米爾語字體這是我的泰米爾UTF-8 unicode字符串如何使用Android的

「\ u00e0 \ u00ae轉移\ u009c \ u00e0 \ u00af \ u0086 \ u00e0 \ u00ae轉移\ u00a9 \ u00e0 \ u00ae轉移\ u00bf \ u00e0 \ u00ae \ u00b2 \ u00e0 \ u00ae \ u00b0 \ u00e0 \ u00ae \ u00af \ u00e0 \ u00ae \ u00e \ u00e0 \ u00ae \ u00aa \ u00e0 \ u00e \ u00ae \ u00ae \ u00ae \ u0095 \ u00e0 \ u00af \ u0088 \ u00e0 \ u00ae \ u00aa \ u00e0 \ u00af \ u008d \ u00e0 \ u00ae轉移\ u00aa \ u00e0 \ u00ae轉移\ u009f \ u00e0 \ u00ae轉移\ u00ae轉移\ u00e0 \ u00af \ u008d」

我想將其解碼和顯示泰米爾字體

Android中的

是這個posible,該怎麼辦?

請幫我

+0

打開您正在使用的WebView或TextView的 – Samuel 2011-04-18 10:15:39

+0

去其他的問題,現在,接受最上面的答案,向SO社區提供預期的反饋。 – 2012-06-30 16:15:02

回答

0

如果你正在使用的WebView,放入資產文件夾中的字體文件「tamilfont.ttf」。 和java代碼將類似於此。注意字體應用於css

data = "<html><head><style>@font-face {font-family: 'tamilfont';src: url('file:///android_asset/tamilfont.ttf');} h1 { font-family: 'tamilfont'; } </style></head><body> <h1>தமிழன்!</h1> </body></html>"; 
    WebView wv = (WebView)findViewById(R.id.webview); 
    wv.loadDataWithBaseURL(null, data, "text/html", "UTF-8", null); 

此方法在android 2.0和2.1中不起作用。

+0

您好我正在使用json並存儲爲字符串 – tamil 2011-04-19 12:47:01

+0

什麼是您的輸出控件顯示? WebView/TextView ... – Samuel 2011-04-20 05:14:48

+0

@PM - Paresh Mayani:你能不能指出我在哪裏提到webview。我認爲'他'是'我'。 ;) – Samuel 2011-07-01 04:44:40

3

在android中顯示泰米爾語的最好方法是使用TSCII字體,如here所述。 Unicode尚未完全支持。

9

您可以保存在文件夾資產泰米爾(TTF)字體,像這樣使用:

TextView text; // initialize to your textview 
Typeface tf = Typeface.createFromAsset(this.getAssets(),"fonts/tamil.ttf"); 
text.setTypeface(tf); 
+0

這個答案對你有幫助嗎? – sparkymat 2011-08-10 06:55:45

3

第1步:下載泰米爾字體.ttf文件。 (例如,說kanchi.ttf)。

第2步:現在在Android項目創建一個目錄在assets文件夾 「字體」。

步驟3:kanchi.ttf文件現在複製到assets/fonts夾在你的Android項目。

第4步:這些行添加到您的onCreate()

protected static Typeface tamil = null; 
tamil= Typeface.createFromAsset(getAssets(),"fonts/kanchi.ttf"); 

第5步:現在提供這種字體您TextView你想要的。

textview= (TextView) findViewById(R.id.tipstext); 
    textview.setTypeface(tamil); 
    textview.setTextSize(20); 
    textview.setText("nkZk;"); 
+0

嗨,感謝您的幫助。我有另一個疑問,我想在這裏顯示像「இந்தமொழியில்:English」這樣的字符串如何在textview中設置 – tamil 2011-07-07 06:11:39

-1

我有一個開泰米爾語字體轉換文檔爲PDF格式,然後嘗試在Android手機

+2

這不是正確的方式來回答一些參考,代碼,鏈接。 – 2012-12-28 06:40:31

+0

指定確切的解決方案 – sreejithsdev 2012-12-28 06:59:10