我在屏幕分辨率为720 x 1280
的手机中使用此命令input tap x y
(input tap 600 500
),该怎么做我转换了 x y
,因此它在分辨率为 1080 x 1920
的手机中将处于同一点。谢谢
最佳答案
此伪代码应该可以为您提供所需的值:
resolution_width = 720;
resolution_height = 1280;
input_x = 600;
input_y = 500;
target_width = 1080;
target_height = 1920;
percent_width = input_x / resolution_width;
percent_height = input_y / resolution_height;
output_x = target_width * percent_width;
output_y = target_height * percent_height;
关于android - 根据屏幕尺寸转换 X 和 Y 像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21581265/