Android doesn't support various fonts like Marathi so this tutorial gives you idea about how to use various font like Marathi in your app.So you can display your data in various languages using the font combination in your app.
Step1)First you have to download the .ttf file like (akshar.ttf for marathi font) which will be used for converting your text according to this font.
Step2)After Downloading this file,You have to copy this file and paste in your asset folder.
Step3)Suppose you take a text view to display to your data which is stored in your string.xml,then you have to write this following code for displaying this data with this font format.
a) TextView t1 = (TextView) findViewById(R.id.t1);
b) Typeface tf = Typeface.createFromAsset(getAssets(), "akshar.ttf");
t1.setTypeface(tf, Typeface.BOLD);
Step4)Next,You have to write this following in your XML.
<TextView
android:id="@+id/t1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/sindhu"
android:textColor="#000000"
android:textSize="6pt" />
Step5)Then you write you string.xml with the following.
<string name="sindhu">सिंधुदुर्ग जिल्हा हा १५.३७ आणि १६.४० उत्तर अक्षवृत्त व ७३.१९ आणि ७४.१८ पूर्व रेखावृत्त या दरम्यान वसलेला आहे.
Thank u....
Step1)First you have to download the .ttf file like (akshar.ttf for marathi font) which will be used for converting your text according to this font.
Step2)After Downloading this file,You have to copy this file and paste in your asset folder.
Step3)Suppose you take a text view to display to your data which is stored in your string.xml,then you have to write this following code for displaying this data with this font format.
a) TextView t1 = (TextView) findViewById(R.id.t1);
b) Typeface tf = Typeface.createFromAsset(getAssets(), "akshar.ttf");
t1.setTypeface(tf, Typeface.BOLD);
Step4)Next,You have to write this following in your XML.
<TextView
android:id="@+id/t1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/sindhu"
android:textColor="#000000"
android:textSize="6pt" />
Step5)Then you write you string.xml with the following.
<string name="sindhu">सिंधुदुर्ग जिल्हा हा १५.३७ आणि १६.४० उत्तर अक्षवृत्त व ७३.१९ आणि ७४.१८ पूर्व रेखावृत्त या दरम्यान वसलेला आहे.
Thank u....



Thank you sir... Shailesh Vishwase
ReplyDeletenice post...where can i download ttf file...plz reply
ReplyDeletehow to type in marathi in XML or which font family is supported for xml.
ReplyDelete@learning c:plz look into this for .ttf file to download:
ReplyDeletehttp://www.findthatfonts.com/search-9348-hTTF/fonts-download-search-engine-akshar.ttf.htm
text exceeds then one line not getting wrap to next line going beyond the screen.
ReplyDeleteHow to use txt or rtf file instead of using it in string.xml.
ReplyDeleteby using you code it not comes properly. it shows me /u2345 /u5647 ... like o/p
thanks in advanced
how to type in marathi ,plz let me know as this is very urgent for my live project
ReplyDeleteMarathi language support from 4.0 and you have put this marathi strings in string.xml file.To type in marathi you have to refer this site....http://www.quillpad.in/index.html#.Uxf_wj-1YUo
ReplyDelete