1

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.

Jin35
  • 8,602
  • 3
  • 32
  • 52
varun
  • 768
  • 7
  • 19
  • Here is some old post which can help you [1]: http://stackoverflow.com/questions/7789827/how-can-i-show-hindi-text-in-android-tablet – Ajay Feb 09 '12 at 11:13
  • of course its possible ,either u can perform localization or directly set text into it tv.setText("हेल्लो"); – Akash Malhotra Apr 19 '13 at 07:37

2 Answers2

5

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)
Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98
Nitesh Khosla
  • 875
  • 8
  • 20
  • i have tried this but its not working. @Nitesh thanks for reply any other suggetion – varun Feb 10 '12 at 10:58
  • @varun: I think the code given by Nitesh is correct.I have tried this for Gujarati Fonts and it's working fine.+1 for this. – Shashank_Itmaster Feb 10 '12 at 12:54
  • @Shashank_Itmaster : ok lets me try it with another hindi font.ttf i have downloaded it from net with it is not working let me try to download another font and check it again. thanks for reply – varun Feb 10 '12 at 13:02
0

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

Akash Malhotra
  • 367
  • 1
  • 12