成人午夜激情影院,小视频免费在线观看,国产精品夜夜嗨,欧美日韩精品一区二区在线播放

在Android開發中使用icon font的代碼和方法

2013-12-13 10:29:04來源:iconfont.cn作者:

IconFont字體不僅僅流行語Web開發,在移動開發中也漸漸的使用的范圍更廣泛。這里介紹在Android開發中使用icon font的代碼和方法。

IconFont字體不僅僅流行語Web開發,在移動開發中也漸漸的使用的范圍更廣泛。這里介紹在Android開發中使用icon font的代碼和方法。

應用步驟:

1、第一步:復制字體文件到項目 assets 目錄;

2、第二步:打開 iconfont 目錄中的 demo.html,找到圖標相對應的 HTML 實體字符碼;

\

3、第三步:打開 res/values/strings.xml,添加 string 值;

<string name="icons">&#x3605; &#x35ad; &#x35ae; &#x35af;</string>

4、第四步:打開 activity_main.xml,添加 string 值到 TextView:

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

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);
}

關鍵詞:Androidiconfont
主站蜘蛛池模板: 太保市| 雷波县| 黄骅市| 海南省| 扶沟县| 手游| 蒲城县| 盖州市| 屯留县| 宾川县| 绥化市| 武鸣县| 巴林左旗| 金平| 鄂伦春自治旗| 绩溪县| 临夏县| 驻马店市| 莒南县| 湖州市| 永泰县| 罗田县| 唐河县| 彰武县| 南丹县| 台东市| 宿迁市| 成都市| 辽宁省| 铜陵市| 德阳市| 法库县| 白城市| 祁门县| 长岛县| 淮滨县| 建阳市| 宜兴市| 巴林左旗| 通渭县| 桃江县|