问题
I have created the Application in which i m Using MapView. Now i want to Use the Back Button in My that MapView. I have develop the Layout but it cant seen the Button over mapview. When i push back button from Emulator then the Mapview become close and the Back button is shown. Can anybudy help me How to Show Back Button on the MapView. ? Thanks.
回答1:
Bo basically it may be possible with the overlays but I have done it using RelativeLayout stuff
<RelativeLayout
android:id="@+id/headerlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
>
<Button android:id="@+id/amap_back_btn" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" android:text="Back">
</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"
android:layout_above="@+id/bottomlayout"
/>
This is all If you find it correct dont forget to mark my answer as check. Best Regards,Anup
回答2:
You will need to use an overlay to add the back button on the MapView. Have a look at this tutorial which explains on how to add overlays. http://www.anddev.org/viewtopic.php?t=92
来源:https://stackoverflow.com/questions/5699577/how-to-set-layout-with-mapview