相关疑难解决方法(0)

是否可以在TextView中包含多个样式?

是否可以为TextView中的不同文本设置多个样式?

例如,我将文本设置如下:

tv.setText(line1 + "\n" + line2 + "\n" + word1 + "\t" + word2 + "\t" + word3);
Run Code Online (Sandbox Code Playgroud)

是否可以为每个文本元素设置不同的样式?例如,line1粗体,word1斜体等.

开发人员指南的常见任务和Android中的操作方法包括选择,突出显示或设置部分文本样式:

// Get our EditText object.
EditText vw = (EditText)findViewById(R.id.text);

// Set the EditText's text.
vw.setText("Italic, highlighted, bold.");

// If this were just a TextView, we could do:
// vw.setText("Italic, highlighted, bold.", TextView.BufferType.SPANNABLE);
// to force it to use Spannable storage so styles can be attached.
// Or we could specify that in the XML.

// …
Run Code Online (Sandbox Code Playgroud)

android styles textview

532
推荐指数
12
解决办法
26万
查看次数

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

我正在寻找一种方法来改变在一个字的文本的颜色TextView从内Activity.

例如,有了这个:

String first = "This word is ";
String next = "red"
TextView t = (TextView) findViewById(R.id.textbox);
t.setText(first + next);
Run Code Online (Sandbox Code Playgroud)

如何将next文本颜色更改为红色?

string android colors textview

88
推荐指数
4
解决办法
8万
查看次数

textview可以有不同颜色的字母吗?

我想显示'123',但是1为红色2,绿色为3,黑色为3 ......这是可能的,还是有其他推荐的方式在同一文本视图中显示不同的文字颜色...

android colors textcolor textview

17
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×3

textview ×3

colors ×2

string ×1

styles ×1

textcolor ×1