如何在图像视图中获取图像的坐标?

时间:2018-11-20 03:38:24

标签: android image animation coordinates

我必须缩放父级布局缩放动画。因此,我得到了图像视图的坐标。但是,图像视图中未实现图像。这意味着我无法制作正确比例的动画。

下面的代码是我的礼物

 @Override
    public void onBindViewHolder(final MyViewHolder holder, final int position) {
        if (data.size() != 0) {
            // TODO Make Method
            holder.thumbImg.post(new Runnable() {
                @Override
                public void run() {
                    if (position == 1) {

                        holder.thumbImg.getLocationInWindow(thumImgXy);
                        thumImgWidth = holder.thumbImg.getWidth();
                        thumImgHeight = holder.thumbImg.getHeight();
                        thumImgPivotX = holder.thumbImg.getPivotX();
                        thumImgPivotY = holder.thumbImg.getPivotY();
                    }
                }
            });
            holder.thumbImg.setId(Integer.parseInt("1001" + position));
            measureThumImgView(holder);

            if (!((position == 0 && data.get(position).getTitle().equals("테스트1")) || ((position == data.size() - 1) && data.get(position).getTitle().equals("테스트2")))) {
                holder.title.setText(data.get(position).getTitle());
                if (position != resumePos) {
                    Glide.with(context).load(data.get(position).getVideoThumbnail()).into(holder.thumbImg);
                } else {
                    holder.thumbImg.setVisibility(View.INVISIBLE);
                }
                holder.itemLayout.setVisibility(View.VISIBLE);
            } else {
                holder.itemLayout.setLayoutParams(new RelativeLayout.LayoutParams(Utility.getDpToPixel(context, 180), Utility.getDpToPixel(context, 70)));
                holder.itemLayout.setVisibility(View.INVISIBLE);
            }
            holder.time.setText(getDuration(data.get(position).getDuration()));
            operations.put(position, true);
        }
    }

如何获取图像视图中图像的坐标?

0 个答案:

没有答案
相关问题