3

我想使用Showcase 库来在RecyclerView.

为此,我需要将项目的坐标传递给库,并在适配器中执行此操作。问题是在onBindViewHolder方法中,坐标仍然为0。我怎样才能正确获得坐标?

我这样做的方式如下:

if (position == 2) {
            final int x = (int) ((RecyclerViewPlaceViewHolder) holder).mPlaceDescriptionTextView
                    .getX();
            final int y = (int) ((RecyclerViewPlaceViewHolder) holder).mPlaceDescriptionTextView
                    .getY();
            new ShowcaseView.Builder((Activity) mContext)
                    .setTarget(new Target() {
                        @Override
                        public Point getPoint() {
                            return new Point(x, y);
                        }
                    })
                    .setContentTitle("ShowcaseView")
                    .setContentText("This is highlighting the Home button")
                    .hideOnTouchOutside()
                    .build();
        }

提前非常感谢!

4

0 回答 0