That works great. Thanks! On Jan 29, 12:46 am, Kostya Vasilyev <kmans...@gmail.com> wrote: > John, > > You can do this with LinearLayout and layout_weight attribute that it > supports: > > <LinearLayout layout_height=fill_parent orientation=vertical> > <View > layout_height="0dp" > layout_weight="20"/> > <TextView > layout_height="0dp" > layout_weight="80"/> > </LinearLayout> > > The top view acts as a spacer, taking up 20% of the screen height, and > the TextView starts below that. > > -- Kostya > > 29.01.2011 10:59, Jonathan Foley пишет: > > > > > > > Yes, but you'll have to do it at runtime as there is not a way to do > > proportional layout as you describe in xml. To prevent a visible > > transition from the xml size to the correct size, you'll probably want > > to extend LinearLayout and override its onLayout(). You'll want to > > layout your child textview within that and you'll want to use > > getHeight() to get the height of the LinearLayout at runtime. I'd > > suggest looking through the code of ListView or RelativeLayout to see > > how children are measured and layout. > > > The other option would be to do this after everything is inflated. You > > can override onFinishInflate of the LinearLayout and then adjust the > > height of the TextView from there. You'll need to invalidate the > > TextView after adjusting it's height. > > > Jonathan > > > On Jan 28, 9:48 pm, John Gaby<jg...@gabysoft.com> wrote: > >> Is there a way to position text within a linear layout such that the > >> position of the text is proportional to the height, rather than a > >> fixed distance. For example, I would like the text to be displayed > >> down from the top a distance equal to 20% of the height of the view. > > >> Thanks. > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget > --http://kmansoft.wordpress.com
-- 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