gpt4 book ai didi

android - 在 ImageView 上移动形状?

转载 作者:行者123 更新时间:2023-11-30 03:50:46 24 4
gpt4 key购买 nike

我正在尝试找到一种方法来实现可以在图像上移动的形状(矩形)。用户会将矩形拖到图像中的某个区域,以最终选择它。

如何做到这一点?我应该使用什么?任何帮助将不胜感激!

最佳答案

使用 Canvas

    choosenImageView = (ImageView) this.findViewById(R.id.ChoosenImageView);

canvas = new Canvas(bitmap); //Bitmap
mBitmapPaint = new Paint();
mBitmapPaint.setAntiAlias(true);
mBitmapPaint.setStyle(Paint.Style.STROKE);
mBitmapPaint.setStrokeWidth(5);
choosenImageView.setOnTouchListener(this);

关于android - 在 ImageView 上移动形状?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14179311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com