如何在Android的改变TextView中的fontFamily中 [英] How to change fontFamily of TextView in Android

查看:586
本文介绍了如何在Android的改变TextView中的fontFamily中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想修改安卓fontFamily中在Android的,但我看不出有任何的Andr​​oid pre定义的字体。如何选择的pre定义的人吗?我并不真的需要定义自己的字体,但所有我需要的是从它表明现在不同。

So I like to change the android:fontFamily in Android but I don't see any pre-defined fonts in Android. How to select one of the pre-defined ones? I don't really need to define my own TypeFace but all I need is something different from what it shows right now.

<TextView
    android:id="@+id/HeaderText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="52dp"
    android:gravity="center"
    android:text="CallerBlocker"
    android:textSize="40dp"
    android:fontFamily="Arial"
 />

看来我就是这样做起来不会有真正的工作! BTW 安卓!fontFamily中=宋体是一个愚蠢的企图

推荐答案

从安卓4.1 / 4.2 / 5.0,以下 Roboto字体的家庭可用:

From android 4.1 / 4.2 / 5.0, the following Roboto font families are available:

android:fontFamily="sans-serif"           // roboto regular
android:fontFamily="sans-serif-light"     // roboto light
android:fontFamily="sans-serif-condensed" // roboto condensed
android:fontFamily="sans-serif-thin"      // roboto thin (android 4.2)
android:fontFamily="sans-serif-medium"    // roboto medium (android 5.0)

与组合

android:textStyle="normal|bold|italic"

这14变型是可能的:

  • Roboto常规
  • Roboto斜体
  • Roboto粗体
  • Roboto粗斜体
  • Roboto光强
  • Roboto光强斜体
  • Roboto薄
  • Roboto薄斜体
  • Roboto冷凝
  • Roboto冷凝斜体
  • Roboto冷凝粗体
  • Roboto冷凝粗斜体
  • Roboto-中
  • Roboto介质斜体
  • Roboto regular
  • Roboto italic
  • Roboto bold
  • Roboto bold italic
  • Roboto-Light
  • Roboto-Light italic
  • Roboto-Thin
  • Roboto-Thin italic
  • Roboto-Condensed
  • Roboto-Condensed italic
  • Roboto-Condensed bold
  • Roboto-Condensed bold italic
  • Roboto-Medium
  • Roboto-Medium italic

这篇关于如何在Android的改变TextView中的fontFamily中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆