How to set font in textview in android?
I do so, but he's getting closer to strength. 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 the .otf
file. It is located in the assets folder. Any idea?
source to share
Try the following:
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "Chantelli_Antiqua.ttf");
txt.setTypeface(font);
Please note that the file extension is "ttf" google search for any font to download in that extension
for example: http://www.creamundo.com/
source to share
Better to use styles and themes and inline fonts for performance and sizing-related application-related issues Styles and themes
source to share
Below is the code I used in my project and it works ... You may need to make some changes.
Typeface myTypeface = Typeface.createFromAsset(this.getAssets(),"segoeuil.ttf");
TextView loantext = (TextView)findViewById(R.id.loantext);
length1.setTypeface(myTypeface);
1) Put the font in the folder with folders instead of font folders 2) instead of getAssests () in your code use "this.getAssets ()" or "youractivity.this.getAssets ()
thank
source to share