2016-12-21 45 views
1

在我的應用中使用地圖在地圖右下角添加按鈕並在GoogleMaps中以不同狀態更改此按鈕的最佳方式是什麼?我使用OSMDroid並需要添加自定義按鈕,而不是默認值。在右下角添加自定義位置按鈕,就像GoogleMaps

enter image description here

+0

一般來說,你可能需要使用的RelativeLayout,並把兩者的觀點,通過OSMDroid庫內部使用(代碼其中您可能會添加您的問題)和自定義按鈕視圖。有關更詳細的答案,請提供更多詳細信息和代碼。 – Galya

回答

2

使用此佈局,並得到你在找什麼

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical"> 

    <RelativeLayout 

     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <fragment 

      android:id="@+id/map" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

     <ImageView 
      android:id="@+id/imageViewFlagPassenger" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:background="@android:color/transparent" 
      android:src="@drawable/marker" /> 

     <ImageView 
      android:id="@+id/btn_passenger_current_location" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentRight="true" 
      android:layout_marginBottom="20dp" 
      android:layout_marginRight="10dp" 
      android:background="@drawable/location_icon" /> 

    </RelativeLayout> 

</LinearLayout>