2011-06-21 10 views

Odpowiedz

9

Najpierw otwórz folder assets i utwórz nowy folder o nazwie font, a następnie umieść Rupali.ttf w folderze font.

<?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> 

I

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); 
    } 
} 

Niedociągnięcie: Wszystkie Bangla łączyć słowa nie działa prawidłowo. Jeśli ktokolwiek ma rozwiązanie, proszę dać mi znać.

1

Proszę śledzić proces podany poniżej:

Utwórz folder o nazwie trwałe w folderze app

utworzyć folder o nazwie czcionki w folderze aktywów

teraz umieścić swoje pragnienie plik czcionki bangla jak durga.ttf lub OTF w folderze czcionek

teraz idź gdzie można zadeklarować swój TextView i umieścić ten kod:

yourTextView.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Durga.ttf")); 
Powiązane problemy