I have a FrameLayout inside my root view (linear:vertical) that I'm using to hold different fragments depending on user input. The FrameLayout is smaller than the background, so it appears to be "floating".
How do I round the corners of the FrameLayout?
The frags that go inside the FrameLayout are not pictures, so I can't crop them.
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"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With