Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

帮你修复了一个bug #3

Open
srxffcc1 opened this issue May 23, 2017 · 0 comments
Open

帮你修复了一个bug #3

srxffcc1 opened this issue May 23, 2017 · 0 comments

Comments

@srxffcc1
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant