所以我想android:fontFamily在Android中更改,但我没有在Android中看到任何预定义的字体.如何选择其中一个预定义的?我真的不需要定义自己的TypeFace,但我所需要的只是它现在所显示的内容.
<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"
/>
Run Code Online (Sandbox Code Playgroud)
看来我在那里做的不会真的有效!BTW android:fontFamily="Arial"是一次愚蠢的尝试!
如何更改a中的字体TextView,默认显示为Arial?如何将其更改为Helvetica?
这样的帖子如何更改Android中TextView的fontFamily表明,您可以在Android 4.2中的styles.xml中指定的Roboto字体的变体归结为以下内容:
这就省去了使用例如TextViews的样式.Roboto-Medium或Roboto-Black字体.
但是为什么谷歌会添加不能用于TextView样式的系统范围的字体呢?当然必须有一些方法来指定styles.xml中的所有Roboto字体(即,不必将字体嵌入为Assets并在代码中创建自定义TextView) - 但是如何?
我有一个最低API级别为14的应用程序.我认为所有兼容设备都应该安装Roboto字体作为默认设置吗?如果我将textView字体设置为Roboto或Roboto Light,它似乎默认为普通的sans字体.
有没有办法使用Roboto而不包括Roboto字体作为资产?
是否可以在ICS中使用Roboto精简或浓缩样式而无需包含.ttf并手动加载它,我的意思是不使用:
Typeface.createFromAsset(this.getAssets(),"fonts/DroidSerif-Bold.ttf");
Run Code Online (Sandbox Code Playgroud)