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

Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed #17

Open
goldencicada opened this issue Apr 11, 2019 · 4 comments
Open

Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed #17

goldencicada opened this issue Apr 11, 2019 · 4 comments

Comments

@goldencicada
Copy link

8.0以后出现bug,更改之后最上面的letter不显示,只显示一块空白区域

@solartcc
Copy link
Member

solartcc commented Apr 12, 2019

将在近期推出调整后的实现,会移除波纹的形式,转换为更通用的样式,感谢关注!

@mark2L
Copy link

mark2L commented Jun 19, 2019

我也遇到这个问题了,在android9的机器上面,最顶部的letter只有一块背景区域显示,上面的内容都没有。
问题的原因好像时出在PinnedHeaderDecoration 这个类里面。但是目前还没找到怎么解决

@mark2L
Copy link

mark2L commented Jun 19, 2019

8.0以后出现bug,更改之后最上面的letter不显示,只显示一块空白区域
@OverRide
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
createPinnedHeader(parent);

    if (mPinnedHeaderView != null) {
        int headerEndAt = mPinnedHeaderView.getTop() + mPinnedHeaderView.getHeight();
        View v = parent.findChildViewUnder(c.getWidth() / 2, headerEndAt + 1);

        if (isPinnedView(parent, v)) {
            mPinnedHeaderTop = v.getTop() - mPinnedHeaderView.getHeight();
        } else {
            mPinnedHeaderTop = 0;
        }

        mClipBounds = c.getClipBounds();
        mClipBounds.top = mPinnedHeaderTop + mPinnedHeaderView.getHeight();

// c.clipRect(mClipBounds);

    }
}

@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
    if (mPinnedHeaderView != null) {
        c.save();

        mClipBounds.top = 0;
        if(Build.VERSION.SDK_INT >= 28){

// c.clipRect(mClipBounds);
}else {
c.clipRect(mClipBounds, Region.Op.UNION);
}
c.translate(0, mPinnedHeaderTop);
mPinnedHeaderView.draw(c);
c.restore();
}
}

我把PinnedHeaderDecoration 类中的Draw里面和onDrawOver里面的c.clipRect(mClipBounds);注释掉,就没有这个问题了,具体原因还不时很清楚

@lyx0224
Copy link

lyx0224 commented Mar 9, 2021

楼上正解

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

4 participants