How to make the height of a MapView map on?

I have interactive icons on the map showing PopupWindow just above the icon when clicked. However, if the icon is located at the very top of the map, PopupWindow will be hidden in the Android status bar. PopupWindow automatically adjusts to the right and left edges of the screen, as well as to the top edge, but does not take into account the status bar panel.

Either there should be a way to place the height of the MapView, or the PopupWindow attribute, which takes into account the status bar. Of course, you can always add the extreme size of a fixed size, but the top panel has different heights on different Android devices.

Can anyone help with this? Thanks!

+4
source share
1 answer

I still have not found a way to configure MapView hieght on the Android status bar, which is unsuccessful.

However, in the case of PopupWindow, it is enough to know the height of the Android status bar, since it is placed on the screen by the encoder. The encoder can then make its own strategy around the problem.

According to another post, here's how to do it:

Rect rectgle = new Rect(); Window window = getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(rectgle); statusBarHeight = rectgle.top; 

However, be careful not to do this calculation until all window components are initialized, because otherwise it will be zero. This is easy to spot and fix.

BR, Vanja

+1
source

All Articles