Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rightpoint/universalfontcomponents
A library that allows you to set a custom font in xml for all your TextViews
https://github.com/rightpoint/universalfontcomponents
Last synced: 7 days ago
JSON representation
A library that allows you to set a custom font in xml for all your TextViews
- Host: GitHub
- URL: https://github.com/rightpoint/universalfontcomponents
- Owner: Rightpoint
- License: apache-2.0
- Created: 2015-05-07T19:10:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-11T21:25:52.000Z (over 6 years ago)
- Last Synced: 2023-03-18T08:01:35.418Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 1.88 MB
- Stars: 11
- Watchers: 27
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[DEPRECATED]
For platform 26 (Oreo) and above (also available in support library 26 and above), use the native Platform Components and fontFamily parameter.
For more information about font management :https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html#programmatically
# UniversalFontComponents
*UniversalFontComponents* is a library that allows you to set a custom font in xml for all your TextViews. You can also set a library-provided Roboto font so that your fonts are consistent across different versions of Android.
## Importing in your project
### Gradle
By standard Gradle use:
```
dependencies {
compile 'com.raizlabs:UniversalFontComponents:1.0.1.1'
}
```## Usage
First, you have to initialize the library.In your Application's onCreate method, call
```java
UniversalFontComponents.init(this);
```to initialize the FontMap.
Setting a universal font for your app can be done one of two ways:
1. Use one of the library-provided roboto fonts, or
2. Inject your own custom font into the view.### Built-In Fonts
To use one of the built-in roboto fonts, use one of the built in views in your layout.xml file and add the universalFont attribute with one of the built-in Roboto fonts specified:
```xml
```### Custom Fonts
To use your own custom font:
1. Add your custom font file to your app's asset folder (../src/main/assets/ExampleCustomFont.ttf)
2. Use one of the built-in views in your layout.xml file and add the customFont attribute with the name of your custom font file specified:```xml
```
The following components are currently provided by the library:
* UniversalFontTextView
* UniversalFontButton
* UniversalFontEditText
* UniversalFontRadioButton
* UniversalFontCheckBox## Maintainers
[Mervyn Anthony](https://github.com/Mervyn-Raizlabs)
[Dylan R. James](https://github.com/dylanrjames)