Android ObjectAnimator does not update View parent

Goal:

Create a SlideUp animation in a fixed-height ImageView that fits in a LinearLayout with a wrap_content height.

Problem:

The animation runs fine, but the parent LinearLayout does not resize itself during or after the animation. I mean, if it is set to "wrap_content", and "content" changes its position (y axis to -100), is it expected that the parent element accompanies the animation, "animating" its height to 0 or not?

How can I make it continue to β€œshake” the contents during the animation?

PS: No, it's not about fillAfter, I use ObjectAnimator, which changes the properties of real objects, not just the drawn view. For example, a click event does not fire in the place where the image was used before the animation.

My code is:

ObjectAnimator oa = ObjectAnimator.ofFloat(findViewById(R.id.menu_tile_image), "y", 0, -100);

Layout Structure:

LinearLayout (match_parent, wrap_content)> ImageView (fill_parent, 100)

Any clue to this? Thanks!

+4
source share

Source: https://habr.com/ru/post/1479101/


All Articles