0

Currently I can set the background of my TextView with this drawable, and it works perfectly fine for borders on all four sides.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke
        android:width="2dp"
        android:color="@color/border_color" />
</shape>

However, I only want this border for top and bottom. Is there a way to modify the existing the drawable to achieve it? I know there are some answers using <layer-list>, but is that the only way?

user3277633
  • 1,891
  • 6
  • 28
  • 48
  • 1
    You have to draw two solid ractangles. see here [here](http://stackoverflow.com/a/4313329/805105) – sohailehmad Apr 02 '17 at 20:34
  • 3
    Possible duplicate of [Is there an easy way to add a border to the top and bottom of an Android View?](http://stackoverflow.com/questions/1598119/is-there-an-easy-way-to-add-a-border-to-the-top-and-bottom-of-an-android-view) – sohailehmad Apr 02 '17 at 20:34

0 Answers0