Hi, I need to find out how wide a button with particular text will be before displaying a layout. Is this a valid way of doing it behind the scenes?:
LinearLayout lll = new LinearLayout(getContext()); Button btn = new Button()); btn.setText("wonderful!"); lll.addView(tvs); lll.measure(1000, 1000); lll.layout(0, 0, 1000, 1000); int width = btn.getWidth(); I have other UI components that have to all be the same width in my layout, as whatever this one button is (the other widgets are placed all over the UI and I can't use any other layout methods to force them to be the same size). So I thought I could create this temporary layout, add my fake button, measure it to get its width, then use that value on all other controls. Right now I'm doing the same thing only in onWindowFocus(), but this happens after the layout has been displayed once, which I'd like to avoid, Thanks -- 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