Tag: 样式

是否有可能在一个TextView中有多个样式?

是否有可能为TextView中的不同部分文本设置多个样式? 例如,我正在设置文本如下: tv.setText(line1 + “\n” + line2 + “\n” + word1 + “\t” + word2 + “\t” + word3); 是否有可能为每个文本元素有不同的风格? 例如,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); […]