welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Wednesday, July 25, 2012

Create different type gradient color in android

Here I will explain to create the different type of gradient color applied in android application.
Normally the gradient colors are used to apply as background color to make our application more style.
In android we can create the three type of gradient color.
1. Linear
2. Radial
3. Sweep
Initially we need to create on xml file with gradient color specification then we can use the xml file throughout the project .we set the xml file as background in any layout used in the activity.
Step 1:
Create new xml file with shape layout,name the xml file bggrad.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android=""
    <gradient android:type="linear"

Here you can set the gradient type as you like there are three types available linear,sweep and radial by changing the radius the shade will be differ. Also set the start and end color
Step 2:
Then use the xml file as background in your all xml files for example see the below code..
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""

Here I set the background bggrad xml file, so your layout has apply the gradient color.
I hope you like this article your valuable comments here……..


Post a Comment