You can use shapes in layer-list
here is the shape_circle.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/shape_circle_rect"/>
<item android:drawable="@drawable/shape_circle_oval"/>
</layer-list>
shape_circle_rect.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@android:color/transparent"/>
<stroke android:width="50dp" android:color="#ffffff"/>
<padding
android:left="-50dp"
android:top="-50dp"
android:right="-50dp"
android:bottom="-50dp"/>
</shape>
shape_circle_oval.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<stroke android:color="#ffffff" android:width="100dp"/>
<solid android:color="@android:color/transparent"/>
</shape>
and Custom Map Fragment
public class MapFragment extends SupportMapFragment{
//...
//Some methods, set up map and etc.
//...
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
View mapView = super.onCreateView(inflater, viewGroup, bundle);
RelativeLayout view = new RelativeLayout(getActivity());
view.addView(mapView, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
FrameLayout frameLayout=new FrameLayout(getActivity());
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
frameLayout.setBackgroundResource(R.drawable.shape_circle);
view.addView(frameLayout);
return view;
}
//...
//...
}