Is there a way to implement rounded corners to a Mapfragment?

Emil Adz picture Emil Adz · Jan 22, 2013 · Viewed 16.3k times · Source

I want to give the map a nice looking rounded corners as the two boxes below it have. I can't do it with the map fragment it self because there is not a background property to a fragment. setting the map inside a layout and setting it background to a rounded shape didn't help me as well and this is the result:

http://i.stack.imgur.com/LJhP1.jpg

I could merge the map but this would make it smaller and i would like to avoid it.

EDIT: @Ryan this is the new result #2:

http://i.stack.imgur.com/69D59.jpg

I guess this is not bad, no even close to the corners on the other boxes, but still not bad with a little more work a could get somewhere close i just dont have a normal image editor. but one thing that still bothers me now is the separation between the "Location" Textview and the map it's self. could i painted the patch in other way so that there was now distance? this is how i did it:

http://i.stack.imgur.com/1Qx66.png

Well I have finally figured this out:

http://i.stack.imgur.com/bY4N5.jpg

this is what i used for the patch:

enter image description here

Thanks.

Answer

Stephen picture Stephen · Aug 31, 2017

I know it's an old post, but you can try using Cards like so:

<android.support.v7.widget.CardView
    android:layout_width="300dp"
    android:layout_height="350dp"
    android:layout_gravity="center_horizontal|center_vertical"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="20dp"
    app:cardCornerRadius="12dp"
    app:cardElevation="12dp">

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</android.support.v7.widget.CardView>

enter image description here