控制不同的文字字体(Typeface对象的使用)

控制不同的文字字体(Typeface对象的使用)

         新建一个继承Activity类的TypefaceActivity,并设置布局文件为:typeface.xml。

这里还是在typeface.xml文件中创建一个TextView组件和3个Button组件。

一个Button空值TextView的字体,2个控制TextView的大小。

typeface.xml的代码:

xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

 

    <TextView

 

        android:id="@+id/typeface_tv01"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"

        android:text="@string/typeface_tv01" />

 

    <Button

        android:id="@+id/typeface_btn01"

        style="@android:style/Widget.Button.Inset"

        android:layout_width="fill_parent"

        android:layout_height="wrap_content"

        android:text="@string/change_text_type" />

 

    <Button

        android:id="@+id/typeface_btn02"

        style="@android:style/Widget.Button.Inset"

        android:layout_width="fill_parent"

        android:layout_height="wrap_content"

        android:text="@string/big" />

 

    <Button

        android:id="@+id/typeface_btn03"

        style="@android:style/Widget.Button.Inset"

        android:layout_width="fill_parent"


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部