how to get android gradient center light effect?
Make a new Android xml file (say GreyRadial.xml) file in your drawable folder
In your xml file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:centerColor="#c1c1c1"
android:endColor="#4f4f4f"
android:gradientRadius="400"
android:startColor="#c1c1c1"
android:type="radial" >
</gradient>
</shape>
Use this xml in your layout background using
android:background="@drawable/GreyRadial"
The effect can be approximated in a Layer-List using multiple rectangular shapes. Use a solid rectangle with the center background color. Then use two gradients with the start and end colors the same. Make the center color the same also, except set the alpha to zero.
In the code below the colors are as follows:
@color/background_dark = #ffb8860b
@color/background_light = #ffd2b48c
@color/transparent = #00b8860b
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape >
<solid android:color="@color/background_light"/>
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="@color/background_dark"
android:centerColor="@color/transparent"
android:endColor="@color/background_dark"
android:angle="45"/>
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="@color/background_dark"
android:centerColor="@color/transparent"
android:endColor="@color/background_dark"
android:angle="135"/>
</shape>
</item>
</layer-list>