首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2012-06-29 
android:TextView设置背景色和文本颜色?设置TextView控件的背景色和文本颜色很简单,如下:textView01 (Te

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/

热点排行