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

请教一个问题 #40

Open
liuchenc opened this issue Sep 14, 2018 · 6 comments
Open

请教一个问题 #40

liuchenc opened this issue Sep 14, 2018 · 6 comments

Comments

@liuchenc
Copy link

就是pop在recyclerview的item的一个view点击触发之后位于该view的下方弹出.有时候会出现这么个情况,就是会被该item遮挡住,请问这是什么引起的?

@zyyoona7
Copy link
Owner

所有系统版本吗?还是个别手机呢?

@liuchenc
Copy link
Author

我拿几个手机试了下,貌似都有这个问题,应该是复用导致的

@zyyoona7
Copy link
Owner

可以提供一下代码吗?我测试一下

@liuchenc
Copy link
Author

我是写在项目里的,不是写在demo里的.你可以用recyclerview模拟一点数据,item上面给个button,点击的时候弹出pop,这样测试一下

@zyyoona7
Copy link
Owner

我这测试没发现这问题,小米8 Android P 和 模拟器都没有发现遮挡,Adapter 代码:

public class RecyclerPopAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private View.OnTouchListener mOnTouchListener;
    private EasyPopup mRvPop;

    public RecyclerPopAdapter() {
        super(R.layout.layout_item_pop, null);

    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, String s) {
//        baseViewHolder.addOnClickListener(R.id.iv_close);
//        baseViewHolder.itemView.setOnTouchListener(mOnTouchListener);
        AppCompatImageButton closeIv=baseViewHolder.getView(R.id.iv_close);
        if (mRvPop==null) {
            initPop(closeIv.getContext());
        }
        closeIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRvPop.showAtAnchorView(v, YGravity.ABOVE, XGravity.LEFT);
            }
        });
    }

    private void initPop(Context context){
        mRvPop = EasyPopup.create()
                .setContext(context)
                .setContentView(R.layout.layout_right_pop)
                .setAnimationStyle(R.style.RightTopPopAnim)
//                .setHeight(700)
//                .setWidth(600)
                .setFocusAndOutsideEnable(true)
//                .setBackgroundDimEnable(true)
//                .setDimValue(0.5f)
//                .setDimColor(Color.RED)
//                .setDimView(mTitleBar)
                .apply();
    }

    public void setOnTouchListener(View.OnTouchListener onTouchListener) {
        this.mOnTouchListener = onTouchListener;
    }
}

@liuchenc
Copy link
Author

哦,那应该是我自己写的哪里有问题,我再找找看

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

2 participants