DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Empty Drawable Rectangle In Android

12.02.2011
| 5651 views |
  • submit to reddit
        // Using "shape" drawables in Android we can create simple figures. Here is how to create a rectangle with a border.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="#00000000" />

    <stroke
        android:width="2dp"
        android:color="#FFFFFF" />

    <padding
        android:bottom="1dp"
        android:left="1dp"
        android:right="1dp"
        android:top="1dp" />

    <corners android:radius="30dp" />

</shape>