Try this:
Border Line inside cardview:
<android.support.v7.widget.CardView
android:id="@+id/cardview0"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="#000000">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="0.5dp"
android:layout_marginLeft="0.5dp"
android:layout_marginTop="0.5dp"
android:background="#ffffff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="30dp"
android:text="Circle"
android:textColor="#3B64AE" />
<Spinner
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true">
</Spinner>
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
Border line outside cardview:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:background="@drawable/border_line">
<android.support.v7.widget.CardView
android:id="@+id/cardview0"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="1dp"
android:layout_alignParentTop="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="30dp"
android:text="Circle"
android:textColor="#3B64AE" />
<Spinner
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true">
</Spinner>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
drawable -> border_line.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dp"
android:color="000000" />
</shape>
solved Boundry around a view