You can set a shape drawable (a rectangle) as background for the view.
(您可以将形状可绘制(矩形)设置为视图的背景。)
<TextView android:text="Some text" android:background="@drawable/back"/>
And rectangle drawable back.xml (put into res/drawable folder):
(和矩形drawable back.xml(放入res / drawable文件夹):)
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@android:color/white" />
<stroke android:width="1dip" android:color="#4fa5d5"/>
</shape>
You can use @android:color/transparent
for the solid color to have a transparent background.
(您可以使用@android:color/transparent
作为纯色,以获得透明背景。)
You can also use padding to separate the text from the border. (您还可以使用填充来将文本与边框分开。)
for more information see: http://developer.android.com/guide/topics/resources/drawable-resource.html (有关详细信息,请参阅: http : //developer.android.com/guide/topics/resources/drawable-resource.html)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…