Popularity
1.5
Stable
Activity
0.0
Stable
27
4
4

Description

Custom View classes for TextView, EditText & Buttons - to set custom fonts

Programming language: Java
License: Apache License 2.0
Tags: Android     UI Widget     Layout Widget     Demo     Java     Views     Custom View     Android-library    

CustomFontView alternatives and similar packages

Based on the "Demo" category.
Alternatively, view CustomFontView alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of CustomFontView or a related project?

Add another 'Demo' Package

README

CustomFontView

Android Arsenal

Custom font classes for TextView, EditText & Buttons

screenshot_20170816-153601

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!