Hi there, Can a layout expert offer insight here? I have an animation in a lovely LinearLayout ViewGroup object that I get into Java from the XML using findViewById. It's working great most of the time. However, my first call to the animate function at the end of onCreate measures the width of this ViewGroup to be zero. What am I missing? The same object will return correct width measurements later in the thread of execution. How can I get the correct measure from onCreate?
Because of this behavior I have hard-coded values into my application for the Center X which might work nicely on the current HTC devices and then blow up later, or it might look bad in Europe on devices with different screen sizes. I tried a number of things to solve this (force layout, varied animation cache persistence, getMeasuredWidth instead of getWidth, invalidate on the ViewGroup and parent). The layout and the component's measurements should be the same for onCreate as it is in another method in the Activity that responds to touch input from the user. Also note that if I navigate in the app to another activity, change orientation, and then return to the first activity, this scenario also causes the ViewGroup's getWidth command to be zero. That is why I assume the issue is related to onCreate. How do I get the correct measure of a (linearlayout) component when executing from onCreate? Is there something in the window's drawing sequence that I need to workaround? Any tips or suggestions are most welcome. Regards, Beth --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

