I'm using RelativeLayout to create rows of controls and would like to 
achieve the following: 
 
    Widget 1 - natural height 
    Custom view - remaining space after Widgets 1 and 3 
    Widget 3 - natural height 
 
If I add the view in the correct order and use FILL_PARENT, it uses the 
remaining space at that point - i.e., all following controls aren't visible 
as there's no more room. 
 
If I add the view at the end, using the BELOW rule to position below Widget 
1, it does that - but overlaps all following controls (e.g. Widget 3, since 
that was set to be below Widget 1 as well). 
 
I tried adding a second rule to say ABOVE Widget 3, but then it didn't seem 
to place the view at all (or made it zero height?). 
 
I can't seem to measure the controls even after calling setContentView(my 
relative layout), they always return zero - so I can't even calculate the 
remaining space manually and use that. 
 
Is there another way to achieve this, or is there a way to measure the 
desired height of a control? I tried calling measure(some width, 
MeasureSpec.UNSPECIFIED) (after setContentView() ) but that also returned 
zero - very helpful. 
 
If there were a way to get notified when the layout takes place (so I can 
call the superclass to actually lay out, then measure / calculate heights 
and re-layout with a fixed height for the view) then that would help, but I 
can't find anything like that either. I would rather not use a fixed height 
and a scrolling view, as scrolling makes an app less pleasant to use 
(unless it's meant to be a list of things!). 
 
If possible, I would like the solution to be compatible with 2.1 (API 7). 
 
Thanks in advance. 
 

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

Reply via email to