2016-12-21 5 views
1

Googleマップのように、私のアプリの右下にボタンを追加して、このボタンをさまざまな状態で変更する最も良い方法は何ですか?私はOSMDroidを使用しており、デフォルトではなくカスタムボタンを追加する必要があります。Googleマップのように右下隅にカスタム位置のボタンを追加する

enter image description here

+0

探しているものを一般的にあなたがRelativeLayoutを使用する必要があります話すとOSMDroidライブラリで使用されるビュー、(コードの両方の内側に入れますあなたの質問に追加することができます)、およびカスタムボタンビュー。より詳細な答えについては、plsは詳細とコードを提供します。 – 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> 
関連する問題