【发布时间】:2013-01-02 03:01:38
【问题描述】:
我的布局如下所示:
<FrameLayout
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"/>
</FrameLayout>
“图像”开始时是全屏显示。为“图像”设置了一个 onTouchListener,效果很好。然后我用 ScaleAnimation 缩放“图像”(大约一半大小),我期望发生的是 onTouchListener 只会在“图像”被触摸时拾取,但它仍然会在整个屏幕上触发并且 getX 得到相同值作为 getRawX。
有什么方法可以检测我是否在 onTouch 的图像边界内?我考虑过根据比例值对边界进行硬编码,但肯定有更优雅的解决方案吗?
【问题讨论】:
标签: android animation touch-event