Using Custom Font


Free Fonts:

www.dafont.com

webpagepublicity.com

www.fontsquirrel.com


1.       Use downloaded :
a.       Download the font file (ex: abc.ttfabc.xml, abc.ttf  any type font file).
b.      Res è Make a directory name [ “font” ]
c.       Copy and paste the font file
d.      Now : - for set font
                                                                           i.      Declare and initial the textview in java file
                                                                         ii.      .java file à oncreate() à
 Code : 

AssetManager am = context.getApplicationContext().getAssets();

    typeface = Typeface.createFromAsset(am,
            String.format(Locale.US, "fonts/%s", "abc.ttf"));

    setTypeface(typeface);
or try this way:
   TextView tx = (TextView)findViewById(R.id.textview1);

   Typeface custom_font = Typeface.createFromAsset(getAssets(),  "fonts/abc.ttf");

   tx.setTypeface(custom_font);
h





মন্তব্যসমূহ

এই ব্লগটি থেকে জনপ্রিয় পোস্টগুলি

API (Application Programming Interface) .

Add Gif file in Android xml file