so how can I get the height of those TextViews then? I need them right after the table has been built. The table builds and fills the TextViews with various text-contents. If the user clicks on a TableRow-title then the according TextView collapses, leaving just the title visible. If the user clicks the TableRow-title again the TextView expands and the text is visible again (with the proper height). This does work well. But what does not work is if the user presses the "Menu" button and selects "Collapse All" and wants to expand a specific entry in the table afterwards. After pressing "Collapse All" I want to get all the heights of the variours TextViews but I only get 0 (zero) values. It somehow must be possible to get the real heights, doesn't it?
On Nov 29, 5:14 am, Romain Guy <romain...@google.com> wrote: > The height is set only after the first layout pass has occurred. You are > calling getHeight too early. > > On Nov 28, 2009 12:26 PM, "Dominik Erbsland" <derbsl...@gmail.com> wrote: > > I have a very odd problem - or perhaps it's just odd to me. > > I have an Activity in which I have a TableLayout. I fill the table > with TableRows in which I display TextViews. Imagine this as a > classical table with text content. After the loop is finished I want > to read all the heights in pixels of all the TextView in this table. I > do this with getHeight(). > > The problem I have now is that ALL the values are 0 (zero) pixels. > Even though I have text in the TextViews. The odd thing about this is, > if I read the height of the exact same TextViews in an OnClickListener > () then I do get the real height of the elements. Why is that so? I > mean, nothing has changed in the height of those elements in the time > between filling the table and firing the OnClickListener(). > I really need to be able to get the height of the TextViews right > after I filled the table. To get the heights upon a click is too late > already for what I want to do. > > Any ideas? > Thanks in advance! > Dominik > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en