2

I would like to create a circular map fragment view

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:transitionName="@string/map"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_width="200dp"
        android:layout_height="200dp"
        tools:context="com.example.gyang.android.MapActivity"
        class="com.google.android.gms.maps.SupportMapFragment"/>

Currently my fragment is a big square. What is the easiest way to turn this into a circle?

George Yang
  • 694
  • 6
  • 18

1 Answers1

0

For me simplest to make middle transparent shape was by constructing outside part with views: topBox, rightBox, bottomBox, leftBox and leaving middle as blank. I also needed to have rounded corners, for this I used SVG images to simulate corners of transparent middle shape.

enter image description here

Rafael
  • 6,091
  • 5
  • 54
  • 79