Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...