varun
varun

Reputation: 778

how to write in hindi on text view in android

is it possible to write in another language font with in text view in android for example i have created

TextView tv = new TextView(this);
tv.setText("HEllo Android");

here i have wrote Hello Android in English how i can wrote it in hindi language.

i have used image its working fine

 <ImageView android:id ="@+id/header2"
              android:layout_height="wrap_content"
              android:layout_width="fill_parent"

              android:gravity="center"
              android:layout_gravity="center"
              android:paddingTop="0dip"

              android:src="@drawable/why00learn00spanish_index"
              >
   <ImageView/>

any help would appreciate.

Upvotes: 1

Views: 3082

Answers (2)

Akash Malhotra
Akash Malhotra

Reputation: 387

Yes of course its possible. of course its possible ,either u can perform localization or directly set text into it tv.setText("हेल्लो"); If you will images it will get blur

Upvotes: 0

Nitesh Khosla
Nitesh Khosla

Reputation: 875

Download the OTF hindi file and put it into assets folder. Run the code in an activity

Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/hindi.otf");
TextView tv = (TextView) findViewById(R.id.CustomFontText);
tv.setTypeface(tf)

Upvotes: 5

Related Questions