2011-06-21 6 views

答えて

9

最初にassetsフォルダを開き、fontという名前の新しいフォルダを作成し、Rupali.ttffontフォルダに配置します。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <TextView 
     android:id="@+id/DefaultFontText" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textSize="30sp" 
     android:text="Here is some text." /> 
    <TextView 
     android:id="@+id/CustomFontText" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="30sp" 
     android:text="ডিরেক্টর মমনক(!?) করতেছি অন্তত ঘড়িটা যেন বানাতে পারি আমি চেষ্টা করছি"> 
     </TextView> 
</LinearLayout> 

そして、

package com.amader; 

import android.app.Activity; 
import android.graphics.Typeface; 
import android.os.Bundle; 
import android.widget.TextView; 

public class Fonts extends Activity { 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     Typeface tf = Typeface.createFromAsset(getAssets(), 
       "font/Rupali.ttf"); 
     TextView tv = (TextView) findViewById(R.id.CustomFontText); 
     tv.setTypeface(tf); 
    } 
} 

欠点:すべてのバングラ組み合わせた言葉は正しく動作しません。誰かが解決策を持っているなら私に知らせてください。

1

の下に与えられたプロセスに従ってください:appフォルダの下に

作成するフォルダという名前の資産を

は今durga.ttfまたはOTFのようなあなたの欲求バングラフォントファイルを置く資産フォルダの下にフォルダという名前のフォントを作成しますフォントフォルダ

に今、あなたはあなたのTextViewを宣言し、このコードを置く場所に行く:

yourTextView.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Durga.ttf")); 
関連する問題