How to get Hindi fonts in Android..?

前端 未结 6 1352
情书的邮戳
情书的邮戳 2020-12-07 05:12

I\'m new to Android field . I have followed the procedure of getting Hindi fonts on emulator but still Hindi characters are appearing in square boxes. Please help me how to

相关标签:
6条回答
  • 2020-12-07 05:31

    Android does not yet fully support Hindi (droid fonts):

    Read this link.

    0 讨论(0)
  • 2020-12-07 05:32

    This way you can use Hindi font in Android.

    Step 1: Add All Hindi text in res --> values --> string.xml file

    <resources>
    <string name="app_name">गन्ने से समृद्धि</string>
    <string name="ganne_ki_kheti">गन्ने  की  खेती</string>
    <string name="sampark">संपर्क</string>
    

    Step 2: In layout xml file add text tag as android:text="@string/your_text". For Example see below.

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="32dp"
            android:text="@string/ganne_ki_kheti"
            android:textSize="32sp"
            android:textStyle="bold" />
    
    0 讨论(0)
  • 2020-12-07 05:35

    Create a folder in assets as "fonts". Place your .ttf file of font in that.

    then try the code as :

    Typeface fontHindi = Typeface.createFromAsset(getAssets(), "fonts/font.ttf");
    tv.setTypeface(fontHindi);
    

    It works for me. Hope it works for you too.

    0 讨论(0)
  • 2020-12-07 05:44

    First of all download hindi font, d the OTF/TTF file you get, save that in asset folder, eclipse has already the folder, if you are using android studio, then make a new folder in project/app/src/main.

    Then in java file, suppose you have to apply your font on TextView t1, use the code..

    Typeface mytypeface= Typeface.createFromAsset(getAssets(),"font-file_name.TTF");
    t1.setTypeface(mytypeface);
    
    0 讨论(0)
  • 2020-12-07 05:53

    You can download hindi fonts from http://hindi-fonts.com and copy it in /system/font directory of your phone. The font will be installed.

    0 讨论(0)
  • 2020-12-07 05:55

    Set The Hindi Font on TextView in Android

     TextView t = new TextView(this);
     Typeface Hindi = Typeface.createFromAsset(getAssets(), "fonts/mangle.ttf");
     t.setTypeface(Hindi);
     t.setText("Naveen Tamrakar");
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题