读书人

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

发布时间: 2012-06-29 15:48:46 作者: rapoo

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/

读书人网 >Android

热点推荐