阿里巴巴图标超详细使用方法可以看下面这篇教程,本篇精准像素主要分享阿里巴巴图标在Android和IOS上的使用方法。
相关信息
直接上阿里巴巴图标使用教程,废话不啰嗦,Iconfont网站介绍看下面这篇介绍。[xxid]47,136[/xxid]第一步:打开官网阿里巴巴图标官网:https://www.iconfont.cn/第二步:登...
Android使用方法
1、下载iconfont字体图标
2、复制字体文件到项目 assets 目录
3、打开 iconfont 目录中的 demo.html,找到图标相对应的 HTML 实体字符码
4、打开 res/values/strings.xml,添加 string 值㘅 㖭 㖮 㖯
5、打开 activity_main.xml,添加 string 值到 TextView
android:id="@+id/like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/icons"
/>
为 TextView 指定文字import android.graphics.Typeface;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Typeface iconfont = Typeface.createFromAsset(getAssets(), "iconfont/iconfont.ttf");
TextView textview = (TextView)findViewById(R.id.like);
textview.setTypeface(iconfont);
}
iOS使用方法
1、下载iconfont字体图标
2、将字体文件(.tff)添加到工程中
3、打开Info.plist文件,增加一个新的Array类型的键,键名设置为UIAppFonts(Fonts provided by application),增加字体的文件名:iconfont.ttfUILabel * label = [[UILabel alloc] initWithFrame:self.view.bounds];
UIFont *iconfont = [UIFont fontWithName:@"uxIconFont" size: 34];
label.font = iconfont;
label.text = @"\U00003439 \U000035ad \U000035ae \U000035af \U000035eb \U000035ec";
[self.view addSubview: label];
注意:
创建 UIFont 使用的是字体名,而不是文件名
可以打开 demo.html 查找每个图标所对应的 HTML 实体 Unicode 码