user6377113
user6377113

Reputation:

How to set Bangla font to a TextView in Android

Hi i am a Bangladeshi.
I am new in Android programming.
I have a EditText. I need to set Bangla on it.
what can i do.

<EditText android:id="@id+/title"
          android:width="fill_parent"
          android:height="200dp"
          android:text="ঘূর্ণিঝড় রোয়ানুর কারণে"
/>

Upvotes: 1

Views: 1500

Answers (2)

Mohammad Omor
Mohammad Omor

Reputation: 1

        <EditText
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:gravity="center"
            android:inputType="number"
            android:fontFamily="@font/kalpurush"
            android:background="@drawable/edborder"
            android:layout_weight="1"
            android:hint="00" />

Upvotes: 0

user4696837
user4696837

Reputation:

Download your font and keep it in assets folder. Write your text that you set to TextView in strings.xml in values folder

<string name="text_of_title">ঘূর্ণিঝড় রোয়ানুর কারণে</string>

Now add it to TextView like this

<EditText android:id="@id+/title"
      android:width="fill_parent"
      android:height="200dp"
      android:text="@strings/text_of_title"/>

Now write java code to add the font to the TextView

TextView title = (TextView) findViewById(R.id.title);
String BANGLA_FONT_SOLEMAN_LIPI = "/SOLAIMANLIPI_22-02-2012.TTF";
Typeface tf = Typeface.createFromAsset(con.getAssets(),
 BANGLA_FONT_SOLEMAN_LIPI);
title.setTypeface(tf);

Thats all. I hope you will enjoy it.

Upvotes: 5

Related Questions