0

I have a situation where my inflation is fairly tasking (I'm populating a custom date module, that has 3 spinners filled with cusom views, for Month, Date, Year) and as a result the ViewFlipper that this RelativeLayout is being inflated into skips 90% of its animation (the view is supposed to slide in from the right, but instead just appears almost entirely finished in its motion and just animates the last few pixels to the Left).

I'm looking around and not seeing anything in the way of onCompletedInflation or anything like that. But clearly either the the inflate() or the addView() call is async because if it wasn't then there would simply be a pause while it did its work and then the View would animate in smoothly (as it does if the View is simply included in the XML).

So, my question is, how do I prevent the animation from starting until I know for sure that all the inflation and view addition has completed, so that I can get a smooth Flipper animation, rather than just seeing the last few "frames" of the animation after the Main thread has caught up with all it's trying to do?

Yevgeny Simkin
  • 27,946
  • 39
  • 137
  • 236
  • Why not inflate the view in advance if you know that it causes problems(and simply attach it when needed)? – user Aug 10 '13 at 06:02
  • Take a look at this http://stackoverflow.com/questions/7517636/viewgroup-finish-inflate-event – Simon Aug 10 '13 at 06:30
  • @Simon, I think that's exactly what I need. Please post that as a duplicate answer and let's close the question. – Yevgeny Simkin Aug 10 '13 at 07:42
  • @Luksprog, in this case that's not an option. I'm not looking for a klugy alternative, I'm looking for notification of view inflation completion. And I think Simon's link is spot-on. Thanks. – Yevgeny Simkin Aug 10 '13 at 07:44

0 Answers0