Android: Rounded background of a Layout or View


layout/white_rounded_background.xml


<?xml version="1.0" encoding="utf-8"?>
<layer-list
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <item>
        <shape android:shape="rectangle" >
            <corners android:radius="3dip" />
            <solid android:color="#FFFFFF" />
            <stroke android:width="2dp" android:color="#98B0C4"/>
        </shape>
    </item>
</layer-list>

Usage

layout/any_layout.xml


<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:background="@layout/white_rounded_background">

....

</RelativeLayout>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s