2016-03-02 64 views
0

你如何创建一个圆形的谷歌地图?到目前为止,我有一个LinearLayout,里面有3个框架布局。所以顶部框架,地图框架,底部框架。我可以改变地图的高度和宽度。但我不能添加曲率或设置半径,android:shape =“oval”也不行。我的Map.Java扩展了AppCompatActivity。这里是我的activity_map.xml试图创建一个圆形的谷歌地图,MapFragment现在是矩形

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/map" 
      android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:fitsSystemWindows="true" 
tools:context="edu.wayne.memories.Map" 
> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/app_bar" 
    android:layout_width="match_parent" 
    android:layout_height="9dp" 
    android:fitsSystemWindows="true" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     map:layout_collapseMode="pin" 
     map:popupTheme="@style/AppTheme.PopupOverlay" /> 

</android.support.design.widget.AppBarLayout> 

<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.4" 
    > 
    <Button 
     android:id="@+id/favbtn" 
     android:layout_width="173dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="40dip" 
     android:background="@color/btn_logut_bg" 
     android:text="@string/userProfile" 
     android:textAllCaps="false" 
     android:textColor="@color/white" 
     android:textSize="15dp" 
     android:layout_gravity="top" /> 
</FrameLayout> 

<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.7" 
    > 
    <include layout="@layout/content_map" 
     /> 

</FrameLayout> 

<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.4" 

    > 

    <Button 
     android:id="@+id/profile" 
     android:layout_width="173dp" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="40dip" 
     android:background="@color/btn_logut_bg" 
     android:text="@string/favbtn" 
     android:textAllCaps="false" 
     android:textColor="@color/white" 
     android:textSize="15dp" 
     android:layout_gravity="top" /> 


</FrameLayout> 

我content_map.xml

<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/map" 
android:name="com.google.android.gms.maps.MapFragment" 
     android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="edu.wayne.memories.Map" 
/> 

我想怎么圆形映射图的外观和我现在所拥有的: enter image description here

enter image description here

+1

看看http://stackoverflow.com/questions/35647057/android-google-maps-inside-circleview/35648839 – antonio

回答

0

你可以c哎呀我的回答here。也许这是一个骗局,创建图像bg有透明的圆圈,周围的颜色必须与你的背景颜色相同。