开发者

How can I find the current position of a View when it's being translated by a tweening animation?

开发者 https://www.devze.com 2022-12-24 04:32 出处:网络
I have a View in an Android application, which is used to show a graphic. This View is being animated by a translation animation, specified in an XML file. In my case, the translation is moving the Vi

I have a View in an Android application, which is used to show a graphic. This View is being animated by a translation animation, specified in an XML file. In my case, the translation is moving the View from right to left across the screen.

I'd like to be able to tell where on the screen the View is when a touch event occurs, but I can't find any method which would let me do this. I've tried View.getLeft() and View.getTop(), and I've tried getting position settings by overriding onLayoutChanged().

I can see that back in 2008 this sort of thing wasn't possible, but was planned:

http://code.google.com/p/android/issues/detail?id=321

...but can't see if it's ever made it into Android.开发者_运维问答 Anyone know how I might do this?

0

精彩评论

暂无评论...
验证码 换一张
取 消