Android text style missing light, medium, thin,

北城以北 提交于 2019-12-20 16:54:11

问题


When setting custom fonts for a textview, I can only choose normal, bold or italic:

How can I set the style to be light instead of bold in the following example?

<TextViewWithCustomFont
...
android:textStyle="bold"/>

回答1:


This is font specific. Not all fonts have a light, medium, thin attribute/style, but the default font should. You can use the default light font by using fontFamily: sans-serif-light or for thin, fontFamily: sans-serif-thin.

For custom fonts, you would need to include the light version of the font and use it.




回答2:


You can only combine those three attributes :

  • normal
  • bold
  • italic

http://developer.android.com/reference/android/widget/TextView.html#attr_android:textStyle

So it can be :

  • normal
  • bold
  • italic
  • bold | italic


来源:https://stackoverflow.com/questions/18233486/android-text-style-missing-light-medium-thin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!