android的字体相关类Typeface
16lz
2022-01-25
引用: http://blog.csdn.net/chenzheng_java/article/details/6233849
package cn.com.chenzheng_java;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;
/**
* @description 有关字体设置
* @author chenzheng_java
*
*/
public class FontFaceActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fontface);
TextView textView = (TextView)findViewById(R.id.textView_fontface);
/**
* setTypeface(Typeface tf)设置字体
* setTypeface(Typeface tf, int style)设置字体,但是其中依旧还有一些倾斜度或者加粗等设置,则通过style进行设置
*/
/*textView.setTypeface(Typeface.DEFAULT_BOLD,Typeface.ITALIC);
textView.setText("中国人!");*/
Typeface tf = Typeface.createFromAsset(getAssets(), "font/ARIAL.TTF");
textView.setTypeface(tf,Typeface.BOLD_ITALIC);
textView.setText("中国人!字体设置则样!");
}
}
更多相关文章
- Android(安卓)统计图表引擎 AChartEngine(三) - 示例源码折线图
- Android实现录制视频
- android沉浸式状态栏和虚拟按键
- Android里面WebView加载HTML里面点击按钮调我Android方法
- android之ArrayAdaper之Spinner
- android通知栏Notification用法
- Android(安卓)同个TextView设置字体大小不一样
- Android(安卓)之 ProgressBar用法介绍
- Android自定义Dialog以控制其位置和宽高