That's a neat solution. It works! Thank you, Amos.
I really know how to use RelativeLayout.

It's just a small question comes to me, why mapview was stacked on
layer "layout"?
I think mapview is able to be on top layer like as before.

On 8月26ζ—₯, 午後9:38, Amos <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> There's no need to manually handle touch events for displaying the
> zoom controls. The following works for me:
>
> My layout xml file is...
>
> <?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">
>
>    <LinearLayout android:id="@+id/layout"
>         android:layout_width="fill_parent"
>         android:layout_height="fill_parent"
>         />
>
>    <LinearLayout android:id="@+id/layout_zoom"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>         android:layout_alignParentBottom="true"
>         android:layout_centerHorizontal="true" />
>
> </RelativeLayout>
>
> ... And in my onCreate I do:
>
>                 //...
>                 LinearLayout lay=(LinearLayout)findViewById(R.id.layout);
>                 LinearLayout 
> zoom=(LinearLayout)findViewById(R.id.layout_zoom);
>                 _map= new MapView(this, MyConstants.GOOGLE_MAPS_API_KEY);
>                 _map.setClickable(true);
>                 _map.setEnabled(true);
>
>                 _map.displayZoomControls(true);
>
>                 lay.addView(_map, new LinearLayout.LayoutParams(
>                                 LayoutParams.FILL_PARENT,
>                                 LayoutParams.WRAP_CONTENT));
>
>                 View zoomView = _map.getZoomControls();
>                 zoom.addView(zoomView, new LinearLayout.LayoutParams(
>                                 LayoutParams.WRAP_CONTENT,
>                                 LayoutParams.WRAP_CONTENT));
>                 //...
>
> Hope this helps.
>
> Amos
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to