- android提供字体风格不够用,所以我们可以自己添加中文字体
- 下载第三方字体库http://www.font5.com/font.php?tag=Android,然后放到assets目录下,代码中设置即可;以军事字体kaiser 和隶属为例
package com.example.typefacedemo; import android.app.Activity; import android.graphics.Typeface; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends Activity { private TextView textView02; private TextView textView03; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView02 = (TextView) this.findViewById(R.id.text02); textView03 = (TextView) this.findViewById(R.id.text03); Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/lishu.ttf"); Typeface typeFace2 = Typeface.createFromAsset(getAssets(), "fonts/kaise.ttf"); textView02.setTypeface(typeFace); textView03.setTypeface(typeFace2); } }
Android 增加中文字体
最新推荐文章于 2024-02-04 18:44:18 发布
