当前位置: 代码迷 >> Android >> android:TextView设立背景色和文本颜色
  详细解决方案

android:TextView设立背景色和文本颜色

热度:24   发布时间:2016-05-01 20:29:26.0
android:TextView设置背景色和文本颜色

?

设置TextView控件的背景色和文本颜色很简单,如下:

textView01 = (TextView)findViewById(R.id.textView01); textView02 = (TextView)findViewById(R.id.textView02); //设置背景色 textView01.setText("设置了背景色黑色"); //从资源文件中加载颜色 textView01.setBackgroundDrawable( getResources().getDrawable(R.drawable.green)); //设置文本颜色(如透明色:Color.TRANSPARENT) textView02.setTextColor(Color.MAGENTA); textView02.setText("设置文本颜色");



原文地址:android:TextView设置背景色和文本颜色?| http://orgcent.com/android-textview-background-color/
  相关解决方案