In fact I was hacking "focus" to handle a "selection" mechanism. It will be useful in a next version of the SDK to have both states handled. I also found in the documentation: "It also dispatches Tap and Focus- change events to optional listeners. " But we can only listen to focus-change, I had to implement tap listener myself.
On 22 sep, 10:37, Guillaume Perrot <[EMAIL PROTECTED]> wrote: > For those who are interested: > > @Override > protected boolean onTap(int index) > { > /* Set focus on tapped item so that he's drawn over others */ > setFocus(getItem(index)); > > /* Consume tap event */ > return true; > } > > @Override > public boolean onTap(GeoPoint p, MapView mapView) > { > /* > * Here, the user tapped outside a location bubble, consume event > to prevent > * super to remove the focus. > */ > return true; > } > > If you recall populate to update your ItemizedOverlay the focus will > also be lost. > > And the sample drawable: > > <?xml version="1.0" encoding="utf-8"?> > <selector > xmlns:android="http://schemas.android.com/apk/res/android"> > <item > android:state_focused="true" > android:drawable="@drawable/bubble_focused" /> > <item > android:drawable="@drawable/bubble_normal" /> > </selector> > > On 22 sep, 10:26, Guillaume Perrot <[EMAIL PROTECTED]> wrote: > > > > It's probably because MapView doesn't set the state of the bubbles. > > > In fact it works well with state_focused, but we have to handle the > > focus ourself, I had to override the onTap functions to set the focus > > myself. > > I am not sure to understand the concept of focused overlay item... > > > On 12 sep, 18:16, "Romain Guy" <[EMAIL PROTECTED]> wrote: > > > > It's probably because MapView doesn't set the state of the bubbles. > > > Have you tried android:state_selected? > > > > On Fri, Sep 12, 2008 at 4:00 AM, Guillaume Perrot > > > > <[EMAIL PROTECTED]> wrote: > > > > > I found two interesting drawables in ApiDemos: > > > > > <selector xmlns:android="http://schemas.android.com/apk/res/android"> > > > > <item android:state_pressed="true" android:drawable="@drawable/ > > > > black_opaque_box" /> > > > > <item android:drawable="@drawable/black_box" /> > > > > </selector> > > > > > <layer-list xmlns:android="http://schemas.android.com/apk/res/ > > > > android"> > > > > <item > > > > android:drawable="@drawable/progress_circular_background" /> > > > > > <item><rotate > > > > android:pivotX="50%" > > > > android:pivotY="50%" > > > > android:fromDegrees="0" > > > > android:toDegrees="360" > > > > android:drawable="@drawable/progress_particle" /> > > > > </item> > > > > </layer-list> > > > > > I found no documentation for this kind of drawable. > > > > > In ItemizedOverlay we can use drawables with state_focused is handled. > > > > I tried to pass the following drawable (bubble.xml) > > > > > <selector > > > > xmlns:android="http://schemas.android.com/apk/res/android"> > > > > <item > > > > android:drawable="@drawable/bubble_normal" /> > > > > <item > > > > android:state_focused="true" > > > > android:drawable="@drawable/bubble_focused" /> > > > > </selector> > > > > > Unfortunately, my map always show bubble_normal even if there is a > > > > focused item (I checked that). > > > > I suppose I have to use another tag than <selector> but I didn't found > > > > in the documentation which tag to use nor all possible tag list. > > > > -- > > > Romain Guywww.curious-creature.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---