Java Android Program to Demonstrate Sweep Gradient in Android

Here is source code of the Program to Demonstrate Gradient Drawables in Android. The program is successfully compiled and run on a Windows system using Eclipse Ide. The program output is also shown below.

A GradientDrawable lets you design complex gradient fills. Each gradient defines a smooth transition between two or three colors in a linear, radial, or sweep pattern. Gradient Drawables are defi ned using the gradient tag as a subnode within a Shape Drawable definition (such as those defi ned in the preceding section). Each Gradient Drawable requires at least a startColor and endColor attribute and supports an optional middleColor. Using the type attribute you can define your gradient as one of the following:
1.Linear
2.Radial
3.Sweep

The following code shows a Sweep gradient within a ring , add the gradient.xml file in your /res/drawable directory.