android使用字体库更改字体

TextView tv = (TextView) this.findViewById(R.id.tv);

// 从assert中获取有资源,获得app的assert,采用getAserts(),通过给出在assert/下面的相对路径。在实际使用中,字体库可能存在于SD卡上,可以采用createFromFile()来替代createFromAsset。
Typeface face = Typeface.createFromAsset(getAssets(),"fonts/aaa.TTF");
tv.setTypeface(face);

猜你喜欢

转载自xindrace.iteye.com/blog/1609381
今日推荐