赞
踩
本文介绍字体图标库简单的封装和使用(以集成Fontawesome为例):
//在app级别的gradle中引入依赖
api 'com.joanzapata.iconify:android-iconify-ionicons:2.2.2'
api 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
public class MyApplication extends Application{
public void onCreate(){
// 加入fontawesome的图标库
Iconify.with(new FontAwesomeModule());
}
}
<com.joanzapata.iconify.widget.IconTextView
// {fa-car}就是字体图标的映射
android:text="I {fa-heart-o} to {fa-code} on {fa-android}"
android:shadowColor="#22000000"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="1"
android:textSize="40sp"
android:textColor="#FFFFFF" />
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。