如何在文本视图中更改单个单词的文本大小和颜色[重复]

Posted

技术标签:

【中文标题】如何在文本视图中更改单个单词的文本大小和颜色[重复]【英文标题】:How to change text Size and color of single word in Text View [duplicate] 【发布时间】:2014-10-23 00:54:06 【问题描述】:

我正在设计一个应用程序,我可以在其中更改单个单词的大小和颜色。我附上图片如下。这是我的 xml 代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listview_with_ad"
android:layout_
android:layout_
android:orientation="vertical" >

<TextView
android:id="@+id/textview"
android:layout_
android:layout_
android:textColor="#00FFFF"
android:textSize="24"
android:text="Download these two Application and get the Environmental Lighting feature for FREE" />

</RelativeLayout>

在这里,我想用大字体和不同颜色显示“免费”字。有什么建议吗?

【问题讨论】:

使用html和css设置文本***.com/questions/6094315/… 我可以更改 xml 文件而不是代码 【参考方案1】:

你可以试试SpannableString,它是一个强大的工具,你可以用它来设置TextView中的多种样式。见this。

【讨论】:

以上是关于如何在文本视图中更改单个单词的文本大小和颜色[重复]的主要内容,如果未能解决你的问题,请参考以下文章

从菜单选项如何更改 TextView 颜色和大小

更改 TextView 中一个单词的文本颜色

更改崇高文本3中特定单词的颜色

如何在swift 3的表格视图中仅更改选定行和未选定行的字体颜色和大小?

动态地,在运行时,如何在 WPF 中更改文本框中某些单词的颜色?

如何在警报视图中更改文本颜色和配置文本触摸操作?