How to make layout with rounded corners..?

Addy picture Addy · Apr 23, 2013 · Viewed 524.8k times · Source

How can I make a layout with rounded corners? I want to apply rounded corners to my LinearLayout.

Answer

Gaurav Arora picture Gaurav Arora · Apr 23, 2013

1: Define layout_bg.xml in drawables:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF"/>
    <stroke android:width="3dp" android:color="#B1BCBE" />
    <corners android:radius="10dp"/>
    <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>

2: Add layout_bg.xml as background to your layout

android:background="@drawable/layout_bg"