2011-03-06 77 views

回答

2

创建一个可绘制的xml文件以创建具有渐变背景的形状。

textview_background.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> 

<gradient 
    android:startColor="#333" 
    android:centerColor="#000" 
    android:endColor="#676" 
    android:angle="270"/> 

<stroke 
    android:width="2dp" 
    android:color="#80808080"/> 



</shape> 

保存在您的绘制目录,并称之为

在布局中要使用什么背景
android:background="@drawable/textview_background" 

。文本视图,布局,按钮...

这应该会给你一些接近你想要的东西,我认为。

渐变中使用的颜色是三重十六进制,我认为你可以使用正常的十六进制。

相关问题