androiddrawable

android drawable border remove bottom line


Here is border xml And I want to remove bottom, how to achieve it?

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners
        android:topLeftRadius="10dp"
        android:topRightRadius="10dp" />
    <solid android:color="@android:color/transparent" />
    <stroke
        android:width="1dp"
        android:color="#DECF7E" />
</shape>

enter image description here


Solution

  • Can you please try below code and check if it gives desired result? It basically creates one background shape and and another shape in front of it. Background shape is just not including padding for bottom

        <?xml version="1.0" encoding="utf-8"?>
        <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
            <item>
                <shape android:shape="rectangle" >
                    <corners
                        android:topLeftRadius="10dp"
                        android:topRightRadius="10dp" />
                    <solid android:color="#DECF7E" />
                    <padding android:top="1dp" />
                    <padding android:left="1dp" />
                    <padding android:right="1dp" />
                </shape>
            </item>
            <item>
                <shape android:shape="rectangle" >
                    <corners
                       android:topLeftRadius="10dp"
                       android:topRightRadius="10dp" />
                    <solid android:color="@android:color/black" />
                </shape>
            </item>
        </layer-list>