一行代码,帮助你快速为各种View替换字体。
Author's weibo: @GcsSloop
Android FontsManager: It can help you change font of view easily !
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.GcsSloop:FontsManager:v1.0.0'
}
if you use Maven, Click Here
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
FontsManager.changeFonts(activity);
FontsManager.changeFonts(view);
FontsManager.changeFonts(viewGroup);
@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
}
Version | Notes |
---|---|
v1.0.0 | From bintray to JitPack. |
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.