0

I have a shape :

<item>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <solid android:color="#000000"></solid>
    </shape>
</item>

<item
    android:top="12dp"
    android:bottom="12dp">
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <corners android:radius="15dp"></corners>
        <solid android:color="#000000"></solid>
        <stroke
            android:width="5dp"
            android:color="#ffffff"></stroke>

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

Which looks OK :

enter image description here

But when i add android:right it looks strange :

enter image description here

And when i add all options(top,left,right,bottom) :

enter image description here

Final code :

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

    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle">
            <solid android:color="#000000"></solid>
        </shape>
    </item>

    <item
        android:top="12dp"
        android:bottom="12dp"
        android:right="2dp"
        android:left="2dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle">
            <corners android:radius="15dp"></corners>
            <solid android:color="#000000"></solid>
            <stroke
                android:width="5dp"
                android:color="#ffffff"></stroke>

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

</layer-list>

What's i doing wrong?

Community
  • 1
  • 1
Sergey Shustikov
  • 15,377
  • 12
  • 67
  • 119

0 Answers0