Reputation: 7191
I would like to know how I can set gradient color in my layout. I want to start with dark green from left side and become lighter to center and from center to right that color should be become darker. How I can do that?
Upvotes: 1
Views: 946
Reputation: 56925
Create one selector file and put in drawable folder.
<?xml version="1.0" encoding="utf-8"?>
<shape>
<gradient
android:angle="90"
android:startColor="#FFFF0000"
android:centerColor="#0000FFFF"
android:endColor="#FF00FF00"
android:type="linear" />
</shape>
Change color as per your requirement. Change angel as per your requirement also.
Look Here for more details.Choose Your Green Color code from here . http://www.december.com/html/spec/color2.html
Upvotes: 5
Reputation: 1629
You have to create a shape drawable as specified here:
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
Here is an example:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="#000"
android:startColor="#fff"
android:type="linear/>
</shape>
Upvotes: 3