Saturday, 27 April 2013

Shape Drawable In Android


shape_1:
<?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="#ff000000"/>

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

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

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

    <stroke
        android:dashGap="2dp"
        android:dashWidth="1dp"
        android:width="4dp"
        android:color="#FFFFFFFF" />

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

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

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

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

    <stroke
        android:dashGap="2dp"
        android:dashWidth="4dp"
        android:width="4dp"
        android:color="#99000000" />

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

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

</shape>


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

    <stroke
        android:dashGap="2dp"
        android:dashWidth="1dp"
        android:width="1dp"
        android:color="#FF000000" />

</shape>


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

    <gradient
        android:angle="270"
        android:endColor="#80FF00FF"
        android:startColor="#FFFF0000" />

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

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

</shape>

No comments:

Post a Comment