I know this question has already been answered but I want you to know that I found a drawable
on Android Studio
that is very similar to the pics you have in the question:
Take a look at this:
android:background="@drawable/abc_menu_dropdown_panel_holo_light"
It looks like this:
Hope it will be helpful
Edit
The option above is for the older versions of Android Studio
so you may not find it. For newer versions:
android:background="@android:drawable/dialog_holo_light_frame"
Moreover, if you want to have your own custom shape, I suggest to use a drawing software like Photoshop
and draw it.
Don't forget to save it as .9.png
file (example: my_background.9.png
)
Read the documentation: Draw 9-patch
Edit 2
An even better and less hard working solution is to use a CardView
and set app:cardPreventCornerOverlap="false"
to prevent views to overlap the borders:
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:contentPadding="0dp">
<!-- your layout stuff here -->
</android.support.v7.widget.CardView>
Also make sure to have included the latest version in the build.gradle
, current is
compile 'com.android.support:cardview-v7:26.0.0'