Iconfont图标库Android/IOS使用方法

阿里巴巴图标超详细使用方法可以看下面这篇教程,本篇主要分享阿里巴巴图标在Android和IOS上的使用方法。

相关信息

Iconfont图标库Android/IOS使用方法插图学习笔记-橙子系统站

Iconfont阿里巴巴图标使用方法

经验分享

直接上阿里巴巴图标使用教程,废话不啰嗦,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 值

<stringname="icons">㘅㖭㖮㖯</string>

5、打开 activity_main.xml,添加 string 值到 TextView

<TextView
android:id="@+id/like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/icons"
/>

为 TextView 指定文字

importandroid.graphics.Typeface;

protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Typefaceiconfont=Typeface.createFromAsset(getAssets(),"iconfont/iconfont.ttf");
TextViewtextview=(TextView)findViewById(R.id.like);
textview.setTypeface(iconfont);
}

iOS使用方法

1、下载iconfont字体图标

2、将字体文件(.tff)添加到工程中

3、打开Info.plist文件,增加一个新的Array类型的键,键名设置为UIAppFonts(Fonts provided by application),增加字体的文件名:iconfont.ttf

UILabel*label=[[UILabelalloc]initWithFrame:self.view.bounds];
UIFont*iconfont=[UIFontfontWithName:@"uxIconFont"size:34];
label.font=iconfont;
label.text=@"\\U00003439\\U000035ad\\U000035ae\\U000035af\\U000035eb\\U000035ec";
[self.viewaddSubview:label];

注意:

创建 UIFont 使用的是字体名,而不是文件名

可以打开 demo.html 查找每个图标所对应的 HTML 实体 Unicode 码

标签 阿里巴巴图标

本文收集于互联网,由 本站 整理编辑,不代表 本站 对观点赞同或支持。如果有侵权、不妥之处,请联系我们删除。敬请谅解!

© 版权声明
THE END
喜欢就支持一下吧
点赞35 分享