AndroidExternalFontsActivity.java |
02 | package com.example.androidhive; |
03 | |
04 | import android.app.Activity; |
05 | import android.graphics.Typeface; |
06 | import android.os.Bundle; |
| import android.widget.TextView; |
| |
| public class AndroidExternalFontsActivity extends Activity { |
| @Override |
| public void onCreate(Bundle savedInstanceState) { |
| super .onCreate(savedInstanceState); |
| setContentView(R.layout.main); |
| |
| |
| String fontPath = "fonts/PINGFANG REGULAR.TTF" ; |
| |
| |
| TextView txtGhost = (TextView) findViewById(R.id.ghost); |
| |
| |
| Typeface tf = Typeface.createFromAsset( |
| |
| // Applying font |
| txtGhost.setTypeface(tf); |
| } |
|
|