FontView

Additional

Language
Java
Version
N/A
Created
Aug 16, 2017
Updated
Aug 21, 2017 (Retired)
Owner
Anitaa Murthy (anitaa1990)
Contributor
Anitaa Murthy (anitaa1990)
1
Activity
Badge
Generate
Download
Source code

Advertisement

CustomFontView

Custom font classes for TextView, EditText & Buttons

How to integrate the library in your app?

Gradle Dependecy
dependencies {
        compile 'com.an.customfontview:customfont:0.1.0'
}

Maven Dependecy

<dependency>
  <groupId>com.an.customfontview</groupId>
  <artifactId>customfont</artifactId>
  <version>0.1.0</version>
  <type>pom</type>
</dependency>

Add fonts

Add your custom fonts to assets/ .
If the assets directory does not already exist, you should create it under src/main/ in your project directory.
You might consider creating a fonts/ subdirectory in the assets directory (as in examples).

Usage

Add the below line to the root layout of your xml file:

xmlns:app="http://schemas.android.com/apk/res-auto"

Custom TextView

.....
       <com.an.customfontview.CustomTextView
          android:layout_gravity="center"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:textFontPath="fonts/gotham_bold.otf"
          android:text="Works for any number of fonts" />
.....

Custom EditText

.....
       <com.an.customfontview.CustomEditText
          android:text="Works for edit text too!"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:editFontPath="fonts/product_sans.ttf" />
.....

Custom Buttons

.....
           <com.an.customfontview.CustomButton
              android:layout_gravity="center"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              app:btnFontPath="fonts/gt_medium.otf"
              android:text="Works for me too!"/>
.....

That's all folks!