2016-03-08 85 views

回答

0

你能提供你的XML佈局?我猜你的地圖與父視圖匹配,其餘視圖在地圖頂部重疊。一個簡單的解決方法是,您可以將地圖視圖和其他視圖排列成垂直的LinearLayout。如下所示:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <CustomMapView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="2" 
     android:id="@+id/mapView" /> 

    <otherView 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"> 
    </otherView> 

</LinearLayout> 
+0

但是,這將阻止地圖填充整個屏幕,只要滑動佈局崩潰,不是嗎?我正在考慮更多的程序化解決方案。無論如何,我會嘗試你的解決方案,看看它是否有效。感謝你 –

+0

請注意,我使用'android:layout_weight'來衡量每個視圖的高度。所以當你想用mapview填充整個屏幕時,只需在'otherView'上設置'setVisibility(View.GONE)'就可以完成工作。 –

+0

抱歉,但這並不奏效。它的真實震盪和觸摸停止正常工作。 - shawn_wx –