1

I'm trying to set a Spark list control to 100% height of a View inside of a TabbedViewNavigatorApplication.

<s:List dataProvider="{dp}" itemRenderer="renderers.Renderer" width="100%" height="100%" />

Using this I can't seem to get the list to fit to the view, it always ends up being much too tall.

I'm testing using the Flash Builder mobile profile, the results seem to be the same across all phones. Setting the height to some number under 50% seems to bring the list closer to full width but it's not consistent across phones.

My app container is set for 160DPI

<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                              xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160" applicationComplete="init(event)">

I haven't come across this issue until I started using TabbedViewNavigatorApplication, 100% seems to work fine in a standard view based application.

Thanks!

francis
  • 5,889
  • 3
  • 27
  • 51
  • I would have expected that to work. If I were to offer a solution, I would recommend sizing the height of the list in updateDisplayList() and using the unscaledHeight - whatever padding is on the default layout. – JeffryHouser Mar 03 '12 at 22:56
  • Yeah me too, do you mean I should override the actual list and handle this inside of that class? – francis Mar 03 '12 at 23:28
  • I tried to implement this inside my views updateDisplayList method but it doesn't seem like this is getting called. – francis Mar 03 '12 at 23:40
  • A component never sizes itself, only it's children. You don't need to override or extend the actual list; you just need to override updateDisplayList() in the class that contains the list as a child. – JeffryHouser Mar 04 '12 at 03:12
  • for some reason when I trace unscaledHeight inside of my view I get 112. This value seems quite low, seems like it could be why 100% is off? – francis Mar 05 '12 at 00:25
  • IF it is that could very well be a reason why you're list does not appear correctly. The question is; why is your view being set to that? Without a code review; and possibly some debugging; it may be tough to tell. – JeffryHouser Mar 05 '12 at 04:10
  • Thanks, I'm really not doing much yet inside of this application. I'll work on trying to recreate the issue inside of a black app – francis Mar 05 '12 at 13:38
  • If you can, don't hesitate to post the full code. If you can't; start adding your code back in one by one and see where things turn go wrong. – JeffryHouser Mar 05 '12 at 13:55
  • Honestly, there is not much going on yet. I have a couple of Singletons I'm using to handle API requests but other than that it's just a view inside of a TabbedViewNavigatorApplication. The only "non standard" action I'm taking is adding/removing ViewNavigator's to my tabbedNavigator. This is so I can separate login views from app views. – francis Mar 05 '12 at 14:16

2 Answers2

0

If you give an object a % height, Flex will still measure the object's height and use the measured height if it is bigger than the calculated percentage.

To prevent this, specify any non-zero value for minHeight (e.g. minHeight="1"). This tells the layout manager that it's ok for the object to be less than its measured height.

Peter Hall
  • 53,120
  • 14
  • 139
  • 204
  • Thanks, just tired that and I'm getting the same result. I'm starting to think this problem may be coming from elsewhere in the project – francis Mar 03 '12 at 23:36
0

Wanted to give an update, looks like I missed something dumb on my end.

I was creating my ViewNavigators using

var vN:ViewNavigator = new ViewNavigator();

I had set my vN width using

vN.percentWidth=100;

But I forgot to set the height

vN.percentHeight=100;

That seemed to fix everything.

Thanks!

francis
  • 5,889
  • 3
  • 27
  • 51