I have a ListFragment that adds 2 views in the onActivityCreated() method – a MapView generic View (persistent header). I’d like the ListView to display underneath the MapView and header in portrait mode and on the right of the MapView and underneath the header in Landscape mode. I’d also like the MapView’s height (in portrait) and width (in landscape) to be a percentage of the available window size (minus action bar, status bar and navigation bar – if one exists on the device). To accomplish this I believe I would need to get the window size and calculate the appropriate heights, widths and layout margins for all 3 views. I’ve tried a few things recommended in similar questions but the solution always returns the height/width of the device and not the window size of the Activity.
Any ideas. Thanks in advance.
I was able to solve this by using a ViewTreeObserver.