我正在尝试找到视图的中心点。对于未旋转的视图,值是正确的,但对于旋转的视图,中心点(0,0)在旋转。在缩放时,宽度和高度在缩放后仍保持不变。
我正在使用以下公式来计算中心点。
int[] location = new int[2];
childView.getLocationOnScreen(location);
int xLocation = location[0] + childView.getWidth() / 2;
int yLocation = location[1] + childView.getHeight() / 2
通过getGlobalVisibleRect
方法,我只能获取可见部分的矩形。
矩阵(Matrix)
? - pskink