[英]How to set Roboto variant font family to a Textview in android?
I have to add Roboto bold font style to my textview.我必须在我的文本视图中添加 Roboto 粗体样式。 How to implement that in android studio.
如何在 android studio 中实现它。
whether I have to add font family from externally or is there an option to add that internally?我是必须从外部添加字体系列还是可以选择在内部添加?
I don't know what to do?我不知道该怎么办? Can you help me to solve this?
你能帮我解决这个问题吗?
对于任何字体系列,我们必须下载该文件(.ttf 格式)并将该文件添加到我们的项目目录中。这也是在字体目录下。添加这些文件后,我们可以使用android:fontFamily
属性在我们的文本视图中使用它。
Right from the Android Docs直接来自 Android 文档
To set a font for the TextView, In the layout XML file, set the fontFamily attribute to the font file you want to access.要为 TextView 设置字体,在布局 XML 文件中,将 fontFamily 属性设置为要访问的字体文件。
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.