Android: el movimiento de animación del contenedor no actualiza correctamente las casillas de acceso de los botones contenidos

So I have an application running on Android 2.2 (on a HTC desire). When the user presses the menu key, my menus silkily slide in from top and bottom. This works just great. Or so I thought. It turns out that even when the ImageButtons are off screen and invisible, the hitboxes of the places where they were before I moved them out of sight activate the buttons.

Yo he tratado:


No difference. At a guess it may be because I am moving the parent container object using the animation rather than the buttons themselves. I can only hypothesise that there is a bug that does not update the child hitboxes. This bug seems to also affect subsequent animations I apply to the button. I have a animation I run on a button that I have previously moved using a different animation. This second animation shrinks then grows the button to give the impression of a click. Only half of the button is redrawn, as that is the half contained within the area of the origional button location.

So the question is, has anyone run into this? Is there anything to try other than moving all the buttons individually (which would get rather tiresome)?

I'd appreciate any ideas at this point!

Muchas Gracias

preguntado el 27 de agosto de 11 a las 21:08

1 Respuestas

Android animations only shifts the pixels of the UI controls when you add animations to them. To actually update the layout after the animation, you should implement an animation listener and manually update the layout other wise the old layout will still remain with the only the pixels shifted.

Respondido 28 ago 11, 03:08

Oh! So it's by design then? That's a bit....rubbish. I'm having trouble imagining a situation where you'd actually want this effect. Oh well, thanks for the tip. I don't suppose there's an easy way to extract the new drawn co-ordinates of the control that has been animated? It seems rather crazy that they offset the draw code, but don't just update the hit boxes/main co-ordinates. Thanks. - BenP

I know its kinda bad. Especially for folks coming from iPhone background. But thats hows the android layout system is built. - bendición

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.