FrameLayout with rounded corners
Create an xml file, e.g. your_rounded_shape.xml
, in your drawable folder and add the following code:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#CCCCCC"/>
<stroke android:width="2dp"
android:color="#999999"/>
<padding android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp"/>
<corners android:radius="8dp" />
</shape>
Then use your_rounded_shape.xml
as a background in your FrameLayout
. Something like this:
<FrameLayout
android:width="match_parent"
android:height="wrap_content"
android:background="@drawable/your_rounded_shape"/>
Replace the FrameLayout with CardView layout.
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp">
</android.support.v7.widget.CardView>