For some reason the other solutions didn't work for me - all borders were shown no matter how I changed it. This worked:
-
-
The color of the border is gray and the background is white for the container (LinearLayout in my example). You can simply change the second item to make the border thicker or have border on the top/left/right.
This is how the layout xml looks like:
I got the idea from here: Is there an easy way to add a border to the top and bottom of an Android View?