android TextView字体切换
来源:互联网 发布:think php框架 编辑:程序博客网 时间:2024/05/22 15:11
布局文件activity_main.xml 内容:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/mHelloWordTv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /></RelativeLayout>
MaintActivity
public class MainActivity extends Activity { /** 资源文件路径 */ public static final String FONTS_PATH = "fonts/GBK.TTF"; /**要改变字体的TextView*/ private TextView mHelloWordTv; /**字体*/ private Typeface mTf; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initViews(); } private void initViews() { mHelloWordTv = (TextView)findViewById(R.id.mHelloWordTv); mTf = Typeface.createFromAsset(getAssets(),FONTS_PATH); mHelloWordTv.setTypeface(mTf); }}
资源文件放置位置
运行,测试搞定.
源代码:http://download.csdn.net/detail/ooppcool/8874189
0 0
- android TextView字体切换
- Android TextView字体加粗
- android TextView 字体设置
- Android自定义TextView字体
- android textview 字体不同颜色
- Android TextView字体设置
- Android textview设置字体
- Android TextView更换字体
- android TextView字体粗细
- Android加粗TextView字体
- Android TextView字体加粗
- Android设置TextView字体
- Android字体切换
- android切换字体
- android-textView-字体的设置
- Android TextView设置字体风格
- ANDROID TEXTVIEW 设置字体颜色
- Android TextView设置字体风格
- LeetCode101 SynmetricTree Java题解
- 数组内数值的排序
- C语言程序设计 C语言中的时间函数
- C++基础---字符串(char型字符串)
- 花擦节 Codis作者黄东旭细说分布式Redis架构设计和踩过的那些坑们
- android TextView字体切换
- QPBOC交易流程详解--POS与卡片的数据交互进行分析
- Html 语法学习笔记一
- poj 1328 Radar Installation 贪心 暑假第三题
- KMP算法
- POJ3694 Network 割边+LCA
- C语言中输入输出重定,freopen()妙用
- Android 5.0 之 Material Desigin初步窥探及Android Studio项目搭建[一]
- POJ 3250 Bad Hair Day 模拟单调栈