Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make two layer circular corner in textview in android

This drawable :

 <shape
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle" >
        <solid android:color="#70628b" />
        <stroke android:width="12dp"
            android:color="#4c3f6e"
            />
        <corners android:radius="8dp"/>
    </shape>

This is my textview

 <TextView
                    android:id="@+id/tv_disabled_frame"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:background="@drawable/disabled_transparent_frame"
                    android:fontFamily="@font/inter_medium"
                    android:gravity="center"
                    android:padding="@dimen/dp_24"
                    android:text="02 : 45"
                    android:textColor="@color/white"
                    android:textSize="@dimen/dp_32"
                    android:textStyle="bold"
                    android:visibility="visible" />

I am trying to apply circular drawable in inside and outside but given code its showing only outer :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Current screen using this code :

enter image description here

Expected screen

enter image description here

I am unable to do circular please help me in this .

>Solution :

try this code

It can show nested corner

<?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="#4c3f6e" />
            <corners android:radius="8dp" />

            <padding
                android:bottom="12dp"
                android:left="12dp"
                android:right="12dp"
                android:top="12dp" />
        </shape>
    </item>

    <item>
        <shape android:shape="rectangle">
            <solid android:color="#70628b" />
            <corners android:radius="8dp" />
        </shape>
    </item>
</layer-list>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading