2016-12-15 73 views
0

如何獲取第一張圖片中的地圖片段,以結束卡片視圖的起始位置,類似於Strava在第二張圖片中的位置。卡片視圖中隱藏的地圖片段的底部

First Image

Second Image

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_height="match_parent" 
android:layout_width="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto"> 

<fragment 
android:id="@+id/map" 
android:name="com.google.android.gms.maps.SupportMapFragment" 
android:layout_width="match_parent" 
android:layout_height="470dp" 
tools:context="com.example.donal.navdrawer.Activities.MapsActivity"/> 

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/maps_toolbar" 
    android:layout_height="?attr/actionBarSize" 
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    android:background="?attr/colorPrimaryDark" 
    android:layout_width="match_parent" 

    /> 

<android.support.v7.widget.CardView 
    android:id="@+id/card_view" 
    android:layout_gravity="bottom" 
    android:layout_width="match_parent" 
    android:layout_height="100dp" 
    android:elevation="4dp"> 
</android.support.v7.widget.CardView> 

</FrameLayout> 
+0

使用MapView代替MapFragment並構建你想要的佈局。 – Divers

+0

您可以使用MapView代替MapFragment檢查此鏈接可以幫助 [https://developers.google.com/android/reference/com/google/android/gms/maps/MapView](https://developers.google .com/android/reference/com/google/android/gms/maps/MapView) –

回答

0

如果定義卡片視圖的layout_height,您可以將片段高度設置爲0dp和重量爲1。這將確保該片段將採取一切剩餘可用空間。

+0

謝謝!有效。 –

+0

@單調哈靈頓沒問題 –