android:TextView设置背景色和文本颜色
2012-04-20 09:10
387 查看
设置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/[/code]
相关文章推荐
- android:TextView中的文本链接之--设置超链接、颜色、字体等属性
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- android之TextView部分本文变颜色,并设置文本监听器
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- android:为TextView加入样式——下划线,颜色,设置链接样式及前背景色
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- android:TextView中的文本链接之--设置超链接、颜色、字体等属性
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- Android之TextView设置String文本颜色
- android textview等文本内容中字体颜色的改变和字体背景色的改变
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- android:TextView中的文本链接之--设置超链接、颜色、字体等属性
- android:为TextView添加样式——下划线,颜色,设置链接样式及前背景色
- Android之TextView设置String文本颜色
- Android 代码里动态设置TextView/Button等的文字颜色Seletor
- android中用Spannable在TextView中设置超链接、颜色、字体
- android 的TextView空间动态设置字体颜色
- Android中TextView通过SpannableString设置字体、大小、颜色、样式、超级链接