Normally, the layout should be ready when the onCreate method is over. Do you have any problems with that?
On Jan 24, 11:40 am, MikeO <[email protected]> wrote: > How can I get notified when the layout is fully calculated? The short > answer is to attached a listener for a callback when the layout is > calculated. Here's what it looks like. > > @Override > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > RelativeLayout vMain = (RelativeLayout) > this.getLayoutInflater().inflate(R.layout.main, null); > vMain.getViewTreeObserver().addOnGlobalLayoutListener( > new ViewTreeObserver.OnGlobalLayoutListener() { > public void onGlobalLayout() { > DisplayLayoutDimensions(); > } > }); > setContentView(vMain); > > } > > public void DisplayLayoutDimensions() > { > StringWriter sw = new StringWriter(1000); > PrintWriter out = new PrintWriter(sw); > TextView t = (TextView) findViewById(R.id.textview); > ImageView img = (ImageView) findViewById(R.id.hp67); > out.printf("\nImage Drawable\n"); > out.printf("ImageView Height dp: %d\n", img.getHeight()); > out.printf("ImageView Measured Height dp: %\n", > img.getMeasuredHeight()); > t.setText(sw.toString()); > > } -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en

