Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use shapes in layer-list <img src="https://i.stack.imgur.com/1YtAw.png" alt="enter image description here"> here is the shape_circle.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:drawable="@drawable/shape_circle_rect"/&gt; &lt;item android:drawable="@drawable/shape_circle_oval"/&gt; &lt;/layer-list&gt; </code></pre> <p>shape_circle_rect.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt; &lt;solid android:color="@android:color/transparent"/&gt; &lt;stroke android:width="50dp" android:color="#ffffff"/&gt; &lt;padding android:left="-50dp" android:top="-50dp" android:right="-50dp" android:bottom="-50dp"/&gt; &lt;/shape&gt; </code></pre> <p>shape_circle_oval.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" &gt; &lt;stroke android:color="#ffffff" android:width="100dp"/&gt; &lt;solid android:color="@android:color/transparent"/&gt; &lt;/shape&gt; </code></pre> <p>and Custom Map Fragment</p> <pre><code> 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; } //... //... } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload