1)Create a folder called fonts under assets folder and place all your fonts in it. (Folder name can be anything)

String fontPath = "fonts/Face Your Fears.ttf";

TextView txt1 = (TextView) findViewById(R.id.txt1);

  Typeface tf = Typeface.createFromAsset(getAssets(), fontPath);
 txt1.setTypeface(tf);
 
More Than One
tv1=(TextView)findViewById(R.id.textView3);
      tv2=(TextView)findViewById(R.id.textView4);
      
      Typeface face= Typeface.createFromAsset(getAssets(), "fonts/font.ttf");
      tv1.setTypeface(face);
      
      Typeface face1= Typeface.createFromAsset(getAssets(), "fonts/font1.ttf");
      tv2.setTypeface(face1);

May be some time replace fonts with font as per your folder name

 

Recent Comments

0 Comments

Sign In To Leave a Comment

Type your Comment below and click to send comment

error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); }