Search code examples
androidrounded-cornersandroid-shape

how to set rounded corners with background tansparency object in android shape xml


I m tying to get rounded corners with background color in shape xml file. But its not working with corners. Here is the output of the code

enter image description here

And here is the code

    <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item>
        <shape android:shape="rectangle" >
            <solid android:color="#aaffffff" />
        </shape>
    </item>
    <item>

        <shape>

        <corners
            android:radius="11dp"   >
        </corners>

        </shape>
    </item>
</layer-list>

A quick help will be appreciated. Thanks in advance !


Solution

  • try this:

    <item>
        <shape android:shape="rectangle" >
            <solid android:color="#aaffffff" />
             <corners android:radius="11dp"   />
        </shape>
    </item>