---
title: "[转]代码实现渐变背景"
author: "119568242"
date: "2011-11-16T14:22:03Z"
tags: []
categories: ["移动开发"]
slug: "untitled"
draft: false
lastmod: "2011-11-21T09:05:58Z"
id: 1261996
url: "https://poolo.iteye.com/blog/1261996"
---

转自：[http://www.iteye.com/topic/1117561](http://www.iteye.com/topic/1117561)

 

 

```
<shape xmlns:android="http://schemas.android.com/apk/res/android"  
    android:shape="rectangle">  
    <gradient  
        android:startColor="#ffffff"  
        android:endColor="#EDEDED"  
        android:angle="-90" />  
</shape>  
```

 

 

和图片一样 放入drawable  配置好把它看成图片调用就好了~

控件xml中 调用 android:background="@drawable/pull\_to\_refresh\_header\_background" 是不是很简单 ~

 

 

P注：放在drawable下 和selector一样用法