David C wrote:
> I have added ZoomControls to a MapView using addView(). When my
> activity loads the controls appear briefly but then disappear, never
> to be seen again. There only seems to be one discussion on this group
> but it didn't explicitly address this issue.
> 
> Can anyone explain why this happens, and how it can be avoided so the
> controls persist? 

Since we can't see your code, it's a little tough to answer your 
question. So let me tell you what works for me:

1. Put something in your layout for the zoom controls:

<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 android:id="@+id/map"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:apiKey="NooYawk"
                android:clickable="true" />
        <LinearLayout android:id="@+id/zoom"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true" />
</RelativeLayout>

2. Add the actual zoom controls to your container:

ViewGroup zoom=(ViewGroup)findViewById(R.id.zoom);
                
zoom.addView(map.getZoomControls());

When I click in the area for the zoom controls (lower left in the 
example shown above), the controls appear for ~2 seconds, or ~2 seconds 
after I last interact with them (if I'm actually working the controls). 
And they reappear the same way.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to