2
(我使用的是像umano應用程序中的滑動佈局) 如何將地圖放在屏幕頂部。 我想將地圖和標記放在屏幕的頂部。 現在它看起來是這樣的: 屏幕頂部的中心地圖。谷歌地圖api android
我如何能做到這一點任何想法?謝謝=)
(我使用的是像umano應用程序中的滑動佈局) 如何將地圖放在屏幕頂部。 我想將地圖和標記放在屏幕的頂部。 現在它看起來是這樣的: 屏幕頂部的中心地圖。谷歌地圖api android
我如何能做到這一點任何想法?謝謝=)
你能提供你的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>
但是,這將阻止地圖填充整個屏幕,只要滑動佈局崩潰,不是嗎?我正在考慮更多的程序化解決方案。無論如何,我會嘗試你的解決方案,看看它是否有效。感謝你 –
請注意,我使用'android:layout_weight'來衡量每個視圖的高度。所以當你想用mapview填充整個屏幕時,只需在'otherView'上設置'setVisibility(View.GONE)'就可以完成工作。 –
抱歉,但這並不奏效。它的真實震盪和觸摸停止正常工作。 - shawn_wx –