2012-04-16 4 views
-1

Я хотел бы добавить изображение чуть выше My Map с двумя кнопками на нем. Как я могу это достичь? Это то, чего я хочу достичь в Android. http://www.machinesthatgobing.com/images/skyhook-iphone-apple.jpgИзображение с кнопками - чуть выше Google Map

+0

ваш вопрос непонятен. Чего вы хотите? где вы хотите добавить изображение? –

+0

@ the top ---> В pic - обзор (обзор - это изображение, а редактирование и начало - кнопки), я хочу добавить кнопки на этом изображении. –

ответ

1

Проверить эту ссылку:

http://android-er.blogspot.in/2011/07/draw-on-custom-view-over-mapview.html

Или

Вы можете достичь этого путем добавления заголовка бар/вид что-то вроде этого, Используйте это изображение в качестве фона в виде заголовка:

<RelativeLayout 
    android:id="@+id/headerlayout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:background="drawable_image/color(Whatever u want)" 
    > 

    <Button android:id="@+id/one" android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" android:text="one"> 
    </Button> 

    <Button android:id="@+id/two" android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:layout_alignParentTop="true" 
     android:layout_alignParentRight="true" android:text="two"> 
    </Button> 
</RelativeLayout> 

<MapViewActivity 
    xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" 
    android:layout_width="wrap_content" android:layout_height="wrap_content" 
    android:clickable="true" android:apiKey="your map key" 
    android:layout_below="@+id/headerlayout" 

    /> 
+0

Спасибо, позвольте мне попробовать. –

0

Попробуйте этот код. Он разместит кнопки на MapView с помощью RelativeLayout

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" android:layout_height="fill_parent"> 
    <com.google.android.maps.MapView 
     xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview" 
     android:layout_width="fill_parent" android:layout_height="fill_parent" 
     android:clickable="true" android:apiKey="your_id" /> 
    <Button android:layout_below="@+id/mapview" 
     android:text="@+id/Button03" 
     android:id="@+id/Button01" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentBottom="true"/> 
    <Button android:layout_below="@+id/mapview" 
     android:text="@+id/Button02" 
     android:id="@+id/Button02" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_alignParentBottom="true"/> 
    <Button android:text="@+id/Button03" 
     android:id="@+id/Button03" 
     android:layout_width="wrap_content" 
     android:layout_toLeftOf="@+id/mapview" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentBottom="true"/> 
</RelativeLayout> 
Смежные вопросы