当前位置:网站首页>Image tagging to obtain the coordinates of the image in the ImageView

Image tagging to obtain the coordinates of the image in the ImageView

2022-06-25 12:17:00 User 9854323

android matrix The most complete method details and advanced ( Full article )

imageView = findViewById(R.id.imageview);
        
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Drawable drawable = imageView.getDrawable();
                Matrix matrix = imageView.getImageMatrix();
                if (drawable != null) {
                    RectF rectf = new RectF();
                    rectf.set(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
                    matrix.mapRect(rectf);     // The most important sentence 
                    Log.i("lcf", "left  " + rectf.left + "  " + rectf.top + "  " + rectf.right + "  " + rectf.bottom);

                }
            }
原网站

版权声明
本文为[User 9854323]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251146400571.html