How to Set Layout with Mapview

蹲街弑〆低调 提交于 2019-12-10 22:39:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!