Friday, January 18, 2013

Rounded corners around any view


There two way set round corner around any view(for example linearlayout)
1. first create a 9-patch image that having corners.
this is easiest way to put corners around linearlayout
must make sure the outside 1-pixel area is completely empty except for the black lines.
2. second method is by drawable xml, see below sample
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
   <stroke android:width="2dp" android:color="#FF00FF00" />
    <solid android:color="#DEE2EE" />
    <padding android:left="7dp" android:top="7dp"
            android:right="7dp" android:bottom="7dp" />
    <corners android:radius="15dp" />
</shape>
see output of this

No comments:

Post a Comment