SimonVT / android-menudrawer

*DEPRECATED* A slide-out menu implementation, which allows users to navigate between views in your app.
http://simonvt.github.com/android-menudrawer/
Apache License 2.0
2.59k stars 1.11k forks source link

There is a blank above actionbar on 3.0.4 #234

Open destinyd opened 10 years ago

destinyd commented 10 years ago
MenuDrawer mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.BEHIND, Position.TOP, MenuDrawer.MENU_DRAG_WINDOW);
mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);

You can see this.

- 20140504 - 184238

in MenuDrawer

@Override
     protected boolean fitSystemWindows(Rect insets) {
       if (mDragMode == MENU_DRAG_WINDOW) {
          mMenuContainer.setPadding(0, insets.top, 0, 0);
       }
        return super.fitSystemWindows(insets);
     }

this code control it,

I change it to

    @Override
    protected boolean fitSystemWindows(Rect insets) {
        if (mDragMode == MENU_DRAG_WINDOW) {
//            mMenuContainer.setPadding(0, insets.top, 0, 0);

            // fix actionbar title big
            ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) this
                    .getLayoutParams();
            int top = params.topMargin + insets.top;
            int bottom = params.bottomMargin + insets.bottom;
            int left = params.leftMargin + insets.left;
            int right = params.rightMargin + insets.right;
            params.setMargins(left, top, right, bottom);
            return true;
        }

        return super.fitSystemWindows(insets);
    }

It work for me. But i don't know what error it will cause.