Android Studioで自分好みのフォントを設定する方法

Android Studioで自分好みのフォントを設定する方法です。

(手順)

1.
appを右クリック>new>Folder>Assets Folder

2.
assetsフォルダができます。

3.
そこに適当にダウンロードしてきたttf,otfファイルを格納

4.
フォントを変更したいTextViewのsetText()の際に以下を書き加えます。

private TextView textview;
textview  = findViewId(R.id.textView);

//ここからフォントを設定
 //第2引数にassetsに格納したファイル名を書く
Typeface newfont = Typeface.createFromAsset(getAssets(), "newfont.ttf");

//textviewにTypefaceをセット
textView.setTypeface(customFont); 

以上です。