Aby łatwo uzyskać dostęp do naszej czcionki, musimy połączyć ją z naszą aplikacją w taki sposób, aby nasz kod mógł ją później załadować. Aby to zrobić, należy utworzyć folder Czcionki w naszych aktywów bezpośrednich
może to być .xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/DefaultFontText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="Here is some text." />
<TextView
android:id="@+id/CustomFontText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="Here is some text.">
</TextView>
Write poniższy kod w swojej klasie .java
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/BPreplay.otf");
TextView tv = (TextView) findViewById(R.id.CustomFontText);
tv.setTypeface(tf);
..to być schludny można mieć czcionek w aktywa/folderu czcionek i dostępu Krój pisma twarzy; face = Typeface.createFromAsset (getAssets(), "fonts /" + "font.otf"); textview.setTypeface (twarz); –