简体   繁体   English

如何在Android中为同一TextView设置自定义字体和文本颜色

[英]How to set both custom font and textcolor for a same textview in android

I have searched a lot in google but i can able to send either one custom font or text in textview but i wanted to set both in the same textview can any one help me in this this my textview 我在Google中搜索了很多东西,但是我可以在textview中发送一种自定义字体或文本,但是我想在同一个textview中设置两者,可以有人帮我这个问题吗?

<TextView
android:id="@+id/pleaseRead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pleasereadthis" />*

you can use lib @ https://github.com/chrisjenx/Calligraphy which provides extensive font capabilities. 您可以使用lib @ https://github.com/chrisjenx/Calligraphy ,它提供了广泛的字体功能。

Else create font like below 其他创建字体如下

 Typeface t = createFromAsset(AssetManager mgr, String path)

and then 接着

textview.setTypeface(t)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM