views:

49

answers:

1

Hello,

I'm trying to dynamically adjust the height of my rows depending on the (screen height - my layout height) / list.size. Unfortunately in the OnCreate method the layout height returns null (not so when i call it in an on click listener).

Is there another method I can call it in?

TIA

+1  A: 

You have to wait until layout happens, which is after onCreate(). You can do so by listening to onSizeChanged() on a View or by posting a Runnable from onCreate() (myView.post(new Runnable() { ... })).

Romain Guy
There seems to be no listener for onSizeChanged in Android 1.6?(I even tried with new View().setOnSize...And findViewById(R.layout.main) returns null...Seems like i'm an idiot but i don't quite grasp android yet...
Chr0n
i put it on the button for which size i'm waiting meanwhile..this.btNext.post(new Runnable() { public void run() { // Initialize tableLayout with Contacts initTableLayout(); } });Thanks for the info.
Chr0n