0

I want two white lines -one on top of the view ,and the other one on the bottom the view!!!

no left and right borders!!!!!

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#00000000"/>
    <stroke android:width="0.1dp" android:color="#FFFFFF" />
    <corners android:radius="5dp"/>
    <padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" />
</shape>

I get a rectangle shaped view with white border,and transparent background.

But i want only the top and bottom lines of rectangle ,and not left and right lines of rectangle .

I want a view with border only on top and bottom,that will seem like sandwiched between two thin lines?

user6265154
  • 353
  • 1
  • 6
  • 19
  • 2
    Possible duplicate of [android shape with bottom stroke](http://stackoverflow.com/questions/19238738/android-shape-with-bottom-stroke) – Bö macht Blau Apr 28 '16 at 11:39
  • 0X0nosugar is wright, there is no natural shape with single stroke lines, you´ll have to do some layerList layout.... – Opiatefuchs Apr 28 '16 at 11:42

1 Answers1

0

Try using <layer-list>. Check this below

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

    <!-- Border -->
    <item>
        <shape android:shape="rectangle">
            <solid android:color="COLOR_OF_BORDER" />
        </shape>
    </item>

    <!-- Rest of the drawable -->
    <item>
        <shape android:shape="rectangle">
            <solid android:color="COLOR_OF_REST" />
            <padding
                android:bottom="2dp"
                android:top="2dp" />
        </shape>
    </item>

</layer-list>
Jimit Patel
  • 4,265
  • 2
  • 34
  • 58