Android 安卓触摸位置
我在触摸手势监听器中使用以下命令来报告用户在屏幕上点击的位置Android 安卓触摸位置,android,touch,screen,Android,Touch,Screen,我在触摸手势监听器中使用以下命令来报告用户在屏幕上点击的位置 String text = "You click at x = " + event.getX() + " and y = " + event.getY(); Toast.makeText(getContext(), text, Toast.LENGTH_LONG).show(); 这给出了触摸屏相对于屏幕分辨率的坐标 我需要的是触摸的坐标与显示的位图的坐标 我的屏幕大小是800 x 1280,但我显示的图像ID是6000 x 400
String text = "You click at x = " + event.getX() + " and y = " + event.getY();
Toast.makeText(getContext(), text, Toast.LENGTH_LONG).show();
这给出了触摸屏相对于屏幕分辨率的坐标
我需要的是触摸的坐标与显示的位图的坐标
我的屏幕大小是800 x 1280
,但我显示的图像ID是6000 x 4000
,因此我需要一种方法来获取触摸的位置,当它被平移到初始800 x1280
有什么想法吗
标记
编辑
MyImageView的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
android:id="@+id/imageView"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
当图像大小为800 x 1280时,您是否能够获得所需的详细信息是如果图像大小为800 x 1280并且不移动,则结果是正确的