Al_R wrote: > Hi all, I'm trying to position elements using the RelativeLayout > system, but the 1st element is giving me headache. I can't find a way > to make it align with another element next to it and also not push the > EditText element from out of the screen. The EditText box is at the > bottom. > > A quick mockup of the layout I want is here: http://i36.tinypic.com/jp9bwg.png > and the XML code I have so far is here: http://pastebin.com/m277be4ea > > I appreciate any help.
With RelativeLayout, start from the edges and work your way towards the center, and be very very careful with your use of fill_parent. So, rather than saying R.id.et is below R.id.sv, say it is alignParentBottom=true, and define it first. Then, define R.id.sv2 as you have it, defined second. Finally, define R.id.tv (dumping the unnecessary ScrollView) as above R.id.et, to the left of R.id.sv2, aligned with the parent top and right, and maybe with the fill_parents. Android makes a single pass through a layout to determine position and size. This gets tricky with RelativeLayout, particularly since you can't forward-reference as-yet-undefined widgets. However, unlike LinearLayout, you don't have to go top-to-bottom with RelativeLayout, AFAIK, so define those widgets that are solely dependent upon the parent bounds first, then those that depend on the first set of widgets, etc. My warning about fill_parent is simply that, when encountered, Android may slurp up all available space upon the desired axis, leaving no room for any widgets to be defined later. Also, use ScrollView only on widgets without intrinsic scrolling. TextView should scroll on its own. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009 http://www.bignerdranch.com/schedule.shtml --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

