https://github.com/gcssloop/fontsmanager
help you change the module font easily.(方便快速的为应用内所有组件更换字体)
https://github.com/gcssloop/fontsmanager
Last synced: about 1 year ago
JSON representation
help you change the module font easily.(方便快速的为应用内所有组件更换字体)
- Host: GitHub
- URL: https://github.com/gcssloop/fontsmanager
- Owner: GcsSloop
- License: epl-1.0
- Created: 2015-05-16T05:33:18.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-12-30T15:26:07.000Z (over 9 years ago)
- Last Synced: 2025-03-30T17:09:50.927Z (about 1 year ago)
- Language: Java
- Homepage:
- Size: 2.55 MB
- Stars: 480
- Watchers: 20
- Forks: 79
- Open Issues: 5
-
Metadata Files:
- Readme: README-EN.md
- License: LICENSE
Awesome Lists containing this project
README
#
FontsManager
[](https://www.apache.org/licenses/LICENSE-2.0)

[](https://jitpack.io/#GcsSloop/FontsManager)
[](http://android-arsenal.com/details/1/1928)
**一行代码,帮助你快速为各种View替换字体。**
## [中文版说明文档戳这里](https://github.com/GcsSloop/AndroidFontsManager/blob/master/README-CN.md)
#### Author's weibo: [@GcsSloop](http://weibo.com/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:
``` gradle
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```
#### Step 2. Add the dependency
``` gradle
dependencies {
compile 'com.github.GcsSloop:FontsManager:v1.0.0'
}
```
> ### if you use Maven, [Click Here](https://jitpack.io/#GcsSloop/FontsManager/)
## Usage
#### Initialization the fontsmanager before use
You can use any of the following four methods to initialize the FontManager.
``` java
// 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
``` java
FontsManager.changeFonts(activity);
```
#### Change View font
``` java
FontsManager.changeFonts(view);
```
#### Change ViewGroup font
``` java
FontsManager.changeFonts(viewGroup);
```
## Complete example
``` java
@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.
```