Android 硬编码

public class TextViewActivity extends Activity {
// 声明TextView对象
private TextView textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_textview);
// 获得TextView对象
textView = (TextView) findViewById(R.id.textView1);
String string = "TextView示例,欢迎使用!";
// 设置文本内容
textView.setText(string);
// 设置文本颜色
textView.setTextColor(Color.RED);
// 设置字体大小
textView.setTextSize(20);
// 设置文字背景
textView.setBackgroundColor(Color.BLUE);
}

}