FontsManager
June 17, 2016 · View on GitHub
一行代码,帮助你快速为各种View替换字体。
中文版说明文档戳这里
Author's weibo: @GcsSloop
Overview
Android FontsManager: It can help you change font of view easily !
Demo

Prepare
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.GcsSloop:FontsManager:v1.0.0'
}
if you use Maven, Click Here
Usage
Initialization the fontsmanager before use
You can use any of the following four methods to initialize the FontManager.
// NO.1
FontsManager.init(typeface); // use typeface
// NO.2
FontsManager.initFormAssets(context, fontPath); // use context and path(file in Assets)
// NO.3
FontsManager.initFormFile(fontFile); // use font file in sdcard
// NO.4
FontsManager.initFormFile(fontFilePath); // use font filePath in sdcard
Change Activity font
FontsManager.changeFonts(activity);
Change View font
FontsManager.changeFonts(view);
Change ViewGroup font
FontsManager.changeFonts(viewGroup);
Complete example
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FontsManager.initFormAssets(this, "sao.ttf"); //initialization
FontsManager.changeFonts(this); //Change Activity font
}
Release Notes
| Version | Notes |
|---|---|
| v1.0.0 | From bintray to JitPack. |
About Me
License
Copyright (c) 2015 GcsSloop
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.