0

I have this to draw a rectangle.

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#00000000" />
    <stroke android:width="1dp" android:color="#ffffff" android:dashWidth="0dp" android:dashGap="0dp" />
</shape>

But I want only 2 horizontal lines on the top and on the bottom. How do we achieve that?

Iwant to achieve no 2

stuckedunderflow
  • 3,551
  • 8
  • 46
  • 63

1 Answers1

0

I got clue from this Open-sided Android stroke?

It works now.

<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This is the line -->
    <item android:top="-1dp" android:right="-1dp" android:left="-1dp">
      <shape>
            <solid android:color="@android:color/transparent" />
            <stroke android:width="1dp" android:color="#ffffff" />
      </shape>
    </item>

    <item android:bottom="-1dp" android:right="-1dp" android:left="-1dp">
      <shape>
            <solid android:color="@android:color/transparent" />
            <stroke android:width="1dp" android:color="#ffffff" />
      </shape>
    </item>    
</layer-list>
Community
  • 1
  • 1
stuckedunderflow
  • 3,551
  • 8
  • 46
  • 63