【发布时间】:2013-01-14 11:16:12
【问题描述】:
这是我的代码。我想部分更改字符串内的文本格式。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String stuff[] = {
"this has to be the bold part this has to be normal part",
"this part of text has to be green this part of text has to be blue",
"this is number 3 bold",
}
【问题讨论】:
-
这个字符串是静态的还是动态的?
-
创建多个 TextView,并将您的字符串拆分为它们。然后你可以为每个 TextView 分别设置样式
-
@MishaBhardwaj 动态和静态。
-
@VeaceslavGaidarji Thanx 但文本必须在单个文本视图中。我希望第一部分格式与第二部分不同,但在“第一部分第二部分”内,。
标签: java android string text-formatting