# IconFont **Repository Path**: wangzhenyu90/IconFont ## Basic Information - **Project Name**: IconFont - **Description**: IconFont使用实例 - **Primary Language**: Android - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-10-31 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #IconFont IconFont字体不仅仅流行于Web开发,在移动开发中也渐渐的使用的范围更广泛。这里介绍在Android开发中使用icon font的代码和方法。 应用步骤: 1、第一步:复制字体文件到项目 assets 目录; 2、第二步:打开 iconfont 目录中的 demo.html,找到图标相对应的 HTML 实体字符码; 3、第三步:打开 res/values/strings.xml,添加 string 值; 㘅 㖭 㖮 㖯 4、第四步:打开 activity_main.xml,添加 string 值到 TextView: 5、第五步:为 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); } [教程地址](http://www.2cto.com/kf/201607/521766.html)