1. 定义包含1 TextView 布局:main.xml

<?xml version="1.0" encoding="utf-8"?>  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"      android:orientation="vertical"      android:layout_width="fill_parent"      android:layout_height="fill_parent"      >  <TextView        android:id="@+id/text"      android:layout_width="fill_parent"       android:layout_height="fill_parent"       android:gravity="center"      />  </LinearLayout> 

2. 下载字体文件 后缀名一般为:*.ttf 如:本例为:biscuit_tin.ttf

* 在工程目录下的 assets 目录下新建文件夹:fonts 然后把*.ttf文件 复制至该目录 并刷新工程

* 代码

public class MyTextTest extends Activity {      /** Called when the activity is first created. */      @Override      public void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.main);                    Typeface fontFace = Typeface.createFromAsset(getAssets(), "fonts/biscuit_tin.ttf");                    TextView text = (TextView)findViewById(R.id.text);          text.setTypeface(fontFace);          text.setText("Hello World!");          text.setTextSize(100);      }  }  

更多相关文章

  1. 《android的SQLite与文件下载》
  2. Android Studio 与git 添加忽略文件
  3. android 入门学习笔记 上传大文件
  4. android实现文件读写功能
  5. Android 本地文件上传到服务器
  6. android--------根据文件路径加载指定文件
  7. android用于打开各种文件的intent,包括以下文件PDF,PPT,WORD,EXC
  8. android 删除sdcard中文件命令
  9. android 不能安装超过600MB文件?

随机推荐

  1. 转:android 实现 流媒体 播放远程mp3文件
  2. Android官方网站!
  3. android 6.0系统 make otapackage 错误
  4. Android绘制进阶之五:位图的处理
  5. Android RecyclerView(1)——范例篇
  6. android 仿微信5版本实现滑动导航条
  7. Android中自定义通用Json解释器
  8. Intent在Android中的几种用法 .
  9. Android Gson 解析泛型报错
  10. Android 6.0 关于WiFi的改变