Reputation: 3450
this is a simple question, but I don't know how to do it.
The gradient has two parts, the result is this.
The code generated is the next, but I don't know how to put inside an only one XML to use as a background.
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="linear"
android:centerX="30%"
android:startColor="#00ffffff"
android:centerColor="#FFffffff"
android:endColor="#00ffffff"
android:angle="0"/>
</shape>
-------------------------------------------------
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="radial"
android:centerX="50%"
android:centerY="50%"
android:startColor="#00ffffff"
android:centerColor="#FFffffff"
android:endColor="#00ffffff"
android:gradientRadius="30"/>
</shape>
Thanks
EDIT:
CODE
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<gradient
android:type="linear"
android:centerX="30%"
android:startColor="#00ffffff"
android:centerColor="#FFffffff"
android:endColor="#00ffffff"
android:angle="0"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<gradient
android:type="radial"
android:centerX="50%"
android:centerY="50%"
android:startColor="#00ffffff"
android:centerColor="#FFffffff"
android:endColor="#00ffffff"
android:gradientRadius="30"/>
</shape>
</item>
</layer-list>
RESULT
Upvotes: 0
Views: 702
Reputation: 19253
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<gradient
android:type="linear"
android:centerX="30%"
android:startColor="#00ffffff"
android:centerColor="#FFffffff"
android:endColor="#00ffffff"
android:angle="0"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<gradient
android:type="radial"
android:centerX="50%"
android:centerY="50%"
android:startColor="#00ffffff"
android:centerColor="#FFffffff"
android:endColor="#00ffffff"
android:gradientRadius="30"/>
</shape>
</item>
</layer-list>
more about Layer List (and other) here
Upvotes: 2