Android TextView 背景颜色与背景图片设置,android textview 控件,android textview 背景,
android textview 图片,android textview 颜色,android textview 组件,android textview background 。
设置文本颜色
设置背景颜色 有三种方法:
setBackgroundResource:通过颜色资源ID设置背景色。 setBackgroundColor:通过颜色值设置背景色。 setBackgroundDrawable:通过Drawable对象设置背景色。
下面分别演示如何用这3个方法来设置TextView组件的背景
setBackgroundResource方法设置背景:
设置背景图片
1、将背景图片放置在 drawable-mdpi 目录下,假设图片名为 bgimg.jpg 。
2、main.xml 文件
ANDROID TEXTVIEW 背景颜色与背景图片设置 2014-06-26 16:34:51 By: dwtedx
Android TextView 背景颜色与背景图片设置,android textview 控件,android textview 背景,
android textview 图片,android textview 颜色,android textview 组件,android textview background 。
设置文本颜色
设置背景颜色
有三种方法:
setBackgroundResource:通过颜色资源ID设置背景色。 setBackgroundColor:通过颜色值设置背景色。 setBackgroundDrawable:通过Drawable对象设置背景色。
下面分别演示如何用这3个方法来设置TextView组件的背景
setBackgroundResource方法设置背景:
设置背景图片
1、将背景图片放置在 drawable-mdpi 目录下,假设图片名为 bgimg.jpg 。
2、main.xml 文件
(责任编辑:蚂蚁团队) |