Reputation: 188
I'm using AndroidResideMenu (https://github.com/SpecialCyCi/AndroidResideMenu) and I've found a problem related with the view size.
The library works by inflating a FrameLayout, removing the current view from the DecorView and adding it to the new FrameLayout (wich also contains scrollviews for adding menu items, and a shadow view).
The old view mantains its size and position, but the new FrameLayout seems to be in fullscreen mode and is hidden under the status bar when the menu is open, as I describe here (https://github.com/SpecialCyCi/AndroidResideMenu/issues/33).
In api14+ devices the problem can be solved by adding a call to setFitsSystemWindow(true) in the ResideMenu, but I don't know what to do in older devices.
Ideas?
Thanks!
Upvotes: 2
Views: 3962
Reputation: 188
Well, I've found the solution.
Just implement the method fitSystemWindows(Rect insets)
, making what is said in the documentation of this method (which I misunderstood until now):
The default implementation of this method simply applies the content insets to the view's padding, consuming that content (modifying the insets to be 0), and returning true. This behavior is off by default, but can be enabled through setFitsSystemWindows(boolean).
So, in the ResideMenu
class:
@Override
protected boolean fitSystemWindows(Rect insets) {
setPadding(paddingLeft + insets.left, paddingTop + insets.top, ...);
insets.left = insets.top = insets.right = insets.bottom = 0;
return true;
}
Hope this helps!
Upvotes: 3