Skip to content

帮你修复了一个bug #3

@srxffcc1

Description

@srxffcc1
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {//解决例如切换fragment不显示的bug
    if(!isMeasured){
        mMenuView = getChildAt(0);
        mContentView = getChildAt(1);
        mMenuView.getLayoutParams().width = mScreenWidth - mMenuOffset;
        mMenuView.getLayoutParams().height = mScreenHeight - getStatusBarHeight(getContext()) - getActionBarHeight();
        mContentView.getLayoutParams().width = mScreenWidth;
        mContentView.getLayoutParams().height = mScreenHeight - getStatusBarHeight(getContext()) - getActionBarHeight();
        isMeasured = true;
    }
    measureChild(mMenuView, widthMeasureSpec, heightMeasureSpec);
    measureChild(mContentView, widthMeasureSpec, heightMeasureSpec);
    setMeasuredDimension(mScreenWidth * 2 - mMenuOffset, mScreenHeight);
}
@Override
protected void onLayout(boolean b, int i, int i1, int i2, int i3) {//解决例如切换fragment不显示的bug
    mMenuView.layout(0, 0, mScreenWidth - mMenuOffset, mScreenHeight - getStatusBarHeight(getContext()) - getActionBarHeight());
    mContentView.layout(mScreenWidth - mMenuOffset, 0, mScreenWidth - mMenuOffset + mScreenWidth, mScreenHeight - getStatusBarHeight(getContext()) - getActionBarHeight());
    if (b) {
        mContentView.setClickable(true);
        mMenuView.setClickable(true);
        mMenuView.setBackgroundColor(Color.TRANSPARENT);
        scrollTo(mScreenWidth - mMenuOffset, 0);
    }

}

具体的可以qq找我 853790230

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions