I am developing application which is having Gujarati font in text-view but my problem is that in text-view it shows the box instead of Gujarati font i have tried by "TypeFace" and text is at string.xml but it is not working please help me i have to submit on tuesday at school so please please help me
Thank you in advance
TextView cap = (TextView) view.findViewById(R.id.caption);
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/gujaratifont.ttf");
cap.setTypeface(tf);
cap.setText(R.string.gujarati);
Drop your file in assets Folder.
Try to do like this. getResources().getString(R.string.gujarati);
Its one reason is because Resources could not get to the TextView. Just Check it out.
TextView cap = (TextView) view.findViewById(R.id.caption);
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"fonts/gujaratifont.ttf");
//(or)
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"gujaratifont.ttf");
cap.setTypeface(tf);
cap.setText(R.string.gujarati);
and place your font file in assets folder.
i.e., create a folder with name fonts in assets folder and place that gujarati font in fonts folder.
if you want gujarati font download it from HERE
TextView mtxt = (TextView) findViewById(R.id.action_settings);
Typeface face1 = Typeface.createFromAsset(getAssets(),
"Lohit-Gujarati.ttf");
mtxt.setTypeface(face1);
mtxt.setText("પૂર્વ વડાપ્રધાન રાજીવ ગાંધી");
Related
I am developing android application in Marathi language,
for that i want to set Marathi font to text view.
So please let me know how to set that
Thanking you..
Put your font in assets folder, then create new Typeface from it
Here is an example
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "SomeFont.ttf");
txt.setTypeface(font);
First of all put your fonts in assests folder in your project.
then in textview in java file where you want to put marathi, use this code:
Typeface mfont = Typeface.createFromAsset(getAssets(), "roboto_light.otf");
<your Textview>.setTypeface(mfont);
Download marathi fonts and save it in assests folder and set typeface using that font.
Sample:
TextView textView = (TextView)findViewById(R.id.textview);
Typeface tf = Typeface.createFromAsset(getAssests(), "name_of_font.ttf");
textView.setTypeface(tf);
you need to pass unicode character like\u... to you textview text.
you can use converter to convert the language. Or can take a look http://www.unicodeonline.com/
For getting the exact value you can pass your unicode into
ResourceBundle.getBundle(unicodestoragelocation,locale).getString(UnicodeValue)
I am new to android development, I need to implement Rich text Editor in my Application. So i googled and found some solutions. I am using this solution:
http://code.google.com/p/android-richtexteditor/source/browse/?r=4#svn/trunk/src/net/sgoliver
It supports the Bold, Italic and Underline in it. Now I want to change the font-style of selected text in EditText, How do i do that?
I know how to set the font-style for all the text in EditText. Suggestions will be appriciated!
Copy the font files (*.ttf) to the assets folder of your application.
Consider I have copied the font file "verdana.TTF" to the assets folder, then the following code will set the font to verdana
EditText et=(EditText) findViewById(R.id.editText1);
Typeface tf = Typeface.createFromAsset(getAssets(),"verdana.TTF");
et.setTypeface(tf);
Hope you got the solution
editText.setTypeface(Typeface.SERIF); as like as TextView.
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/Comic.ttf");
EditText et = (EditText)findViewById(R.id.et);
et.setTypeface(tf);
you can place ttf file in assets and set font style here
try this code..create font folder like this assets/font and put your font file in it..
edittxt = (EditText) findViewById(R.id.edittxt);
Typeface myTypeface = Typeface.createFromAsset( this.getAssets(), "font/YOURFONT.otf");
edittxt.setTypeface(myTypeface);
I have a widget layout containing textview. I want to set marathi text to that textview.
I am trying ticker widget which shows marathi news on screen. the problem is i am unable to set marathi font to remoteview. Any Help? Thanks in advance
Edited:
Here is My code
RemoteViews remoteViews = new RemoteViews(this .getApplicationContext().getPackageName(), R.layout.widget_layout);
// Set the text
remoteViews.setTextViewText(R.id.txt_marqee, stringBuffer);
this is my remoteview inflating widget_layout. And this layout contains textview which i am using as a ticker. I want to set devnagari font to remoteview. Any help?
As Devanagari fonts are not supported by Android, you can still give that support to your Application.
For Marathi font copy font file to your asset folder. then use the following code.
TextView text_view = new TextView(this);
Typeface font = Typeface.createFromAsset(getAssets(), "MarathiFont.ttf");
text_view.setTypeface(font);
text_view.setText("मराठी");
the same way u can give support for hindi....
For this you will have to Get a MarathiFont.ttf file, then
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/MarathiFont.ttf");
and then :
text.setTypeFace(tf);
Dude its so simple Just use follwing line of code
TextView info=(TextView)findViewById(R.id.info);
Typeface face=Typeface.createFromAsset(getAssets(), "fonts/georgia.ttf");
info.setTypeface(face);
Place your font in assets in fonts folder. Work karel. Thanks
First up all you should add the marathi font (ttf) in devices. Below is the adb command for adding the font.
adb su push .ttf /system/fonts/DroidSansFallback.ttf
Then use this font for display.
1)download marathi fonts from website as follows:
http://www.angelfire.com/pop/top4/fonts/
2)apply following code:
TextView info=(TextView)findViewById(R.id.textview);
Typeface face=Typeface.createFromAsset(getAssets(), "fonts/your font.ttf");
info.setTypeface(face);
I am doing like this but it get force close. I want to change textview font.
TextView mWeddingDataandTime=(TextView)findViewById(R.id.wedding_weddingtime_txt);
Typeface face=Typeface.createFromAsset(getAssets(),"fonts/CURLZ_.otf");
mWeddingDataandTime.setTypeface(face);
I am using .otf file. It is in assets folder. Any idea?
Try this:
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "Chantelli_Antiqua.ttf");
txt.setTypeface(font);
Note that file extension is "ttf" search in google for any font for download in this extension
for example:
http://www.creamundo.com/
In code you are using fonts/CURLZ_.otf as path but you say that font file is directly inside assets so your code should be
Typeface face=Typeface.createFromAsset(getAssets(),"CURLZ_.otf");
if there is no fonts folder inside assets folder.
I didn't test it but I think it may help you:
TextView mWeddingDataandTime=(TextView)findViewById(R.id.wedding_weddingtime_txt);
Typeface face=Typeface.createFromAsset(getAssets(),"fonts/CURLZ_");
mWeddingDataandTime.setTypeface(face);
If your font is only in asset folder not in asser/fonts forlder than use this
Typeface face=Typeface.createFromAsset(getAssets(),"CURLZ_.otf");
Below is code which I used in my project & it's working... You might need to do some changes
Typeface myTypeface = Typeface.createFromAsset(this.getAssets(),"segoeuil.ttf");
TextView loantext = (TextView)findViewById(R.id.loantext);
length1.setTypeface(myTypeface);
1) Put font in assets folder instead of fonts folders
2) instead of getAssests() in you code use "this.getAssets()" or "youractivity.this.getAssets()
Thank You
Better to make use of the styles and themes and inbuilt fonts for performance related and size of the app related issues Styles & Themes
My application have listview with friends name in Marathi and Hindi fonts.
But names in Marathi and Hindi fonts are displayed as block.
I also have .ttf file for Marathi and Hindi fonts and i also added that in assets->fonts folder.
Try this ::
here i have set comic font in my textview. you can copy file in assets folder and apply following code :
Typeface face;
face = Typeface.createFromAsset(this.getAssets(), "fonts/comic.TTF");
tran_banner = (TextView) findViewById(R.id.tran_banner);
tran_banner.setTypeface(face, Typeface.BOLD);