- Create a new Project.
- Make a new folder named ‘Font’ into your assets folder
- Paste the font file into this folder
Now add the below written lines into your Java file.
textview
=(TextView)findViewById(R.id.text1);
Typeface
font = Typeface.createFromAsset(getAssets(), "font/Maximum.ttf");
textview.setTypeface(font);
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="180dip"
android:text="@string/Custom_Font"
android:textColor="@android:color/holo_orange_dark"
android:textSize="22sp"/>
Download the Code from here
Comments
Post a Comment