【发布时间】:2015-10-19 19:39:11
【问题描述】:
我正在尝试以最基本的方式在 android studio 中编写问题和答案。我的计划是让答案为白色(当前背景的颜色)......然后当按下答案按钮时,它会将整个事物变为黑色。那么如何让答案以不同的颜色开始呢?
Button button = (Button) findViewById(R.id.questionButton);
button.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
final String[] Text = {
"Q: Who is the first president of the United States? <COLOR SOMETHING TO MAKE THIS WHITE TEXT-> >A: George Washington</COLOR>"
};
【问题讨论】:
-
只使用两个 TextView 并一开始使一个不可见可能更容易。
-
您可以使用以下链接中的跨度,stackoverflow.com/questions/11479560/…
标签: android string button colors styles