>This should work so long as Widget 1 and Widget 3 have knowable
>heights (e.g., Button, not ListView) and there is still room on the
>screen for Widget 2.

Thanks for this. I see where you're going with it, but unfortunately that 
won't help my situation - and that's my fault for not making my example 
clearer. Although I only specified three widgets / views, there could 
potentially be more, and more than one view that would want to grab as much 
space as possible.

Consider the following revised example:

Widget 1 - natural height
Custom View A - largest height possible
Widget 2 - natural height
Custom View B - largest height possible
Widget 3 - natural height
Custom View C - largest height possible
Widget 4 - natural height

Although widgets 1 and 4 could still be aligned to top and bottom, the 
problem now is how to position widgets 2 and 3 (we can't even use 
CENTRE_IN_PARENT now, since view B is in the middle). Since we have three 
views vying for the maximum space they can get, I would want them to each 
grab a third of the remaining space (so equal weight). In other words, the 
way a GridBagLayout would handle it in desktop Java.

I cannot assume the position (order) of any of the widgets or views, since 
I'm trying to build a framework that allows me to add (from a higher layer 
of code) controls of any type in any order, to suit multiple applications, 
without that higher layer having to have knowledge of how that is achieved. 
This mechanism is being translated into other languages / environments such 
as desktop Java, C++ / MFC and C#. The abstracted layer will be [almost] 
directly portable by referring to generic concepts, and this underlying 
layer (unique to each platform) will deal with creating platform-specific 
controls and laying them out as required.

(Controls are being added through code rather than XML, but I realise 
alignments and positions would be equivalent no matter which is used - just 
written differently.)

Do you perhaps know how to reliably measure actual height controls (at what 
point in the code can I get this information - a notification handler?).

If so, can I manually resize the views at a later stage to fit (I assume I 
can, and then simply call requestLayout() )?

Getting the measurements would be an alternative way to solve the problem.

Or am I looking at deriving my own layout manager?

--
Jason Teagle
*jason.tea...@yahoo.co.uk*<wlmailhtml:{6A5D8B3C-A03E-4097-9F53-9278006E9974}mid://00000832/!x-usc:mailto:jason.tea...@yahoo.co.uk>
 

-- 
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

Reply via email to