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

在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
主站蜘蛛池模板: 榆社县| 广南县| 象州县| 寻乌县| 岳普湖县| 中方县| 霍邱县| 应用必备| 霍城县| 茶陵县| 凤山县| 霸州市| 加查县| 云南省| 江达县| 漠河县| 堆龙德庆县| 金山区| 大化| 万宁市| 宁津县| 泉州市| 普兰县| 大荔县| 建湖县| 太康县| 和政县| 杨浦区| 大同县| 恭城| 天全县| 潜山县| 奉新县| 襄汾县| 陇南市| 永川市| 古蔺县| 中超| 漳浦县| 炎陵县| 竹山县|