How to use shapes in android? A simple example.

By | October 23, 2011

In android with shapes we can create beautiful layouts.
Lets look at an example.

Create an xml named “gradient.xml” in your drawable folder and copy this code into it.

Now the main layout file main.xml

The main java file.

package pack.coderzheaven;

import android.os.Bundle;

public class DrawableShapesDemo extends Activity {
    public void onCreate(Bundle savedInstanceState) {

Done. You can now run the application.

Using Shapes

Using Shapes

Leave a Reply

Your email address will not be published. Required fields are marked *