安卓相当于解决类似的View.getX()API 11日之前?类似、View、getX、API

2023-09-06 00:37:54 作者:蛋蛋超人i

我使用的getX()和getY()以对一些特殊的拖动逻辑(没有动画,也就是我从来没有使用setX的/ Y的方法,我只是需要干将检查)的视图方法

I'm using the getX() and getY() method on a view for some special dragging logic (not animation, i.e. I never use setX/Y methods, I just need the getters to check).

不过,我已经认识到,这些只适用后的API 11。

However, I've come to realize that these are only available post-API 11.

该文档的getX()以说是它加入了'左'财产和'translationX'属性。所有的好,除了GET / setTranslationX(好)是因为API 11也只有约。

The docs for getX() say that is it the addition of the 'left' property and the 'translationX' property. All well and good, except get/setTranslationX() is only around since API 11 as well.

我想知道是否有什么幕后的这个方法返回,所以我也许可以把一个解决办法的任何知识。

I was wondering if there was any knowledge on what this method returns behind the scenes, so I could maybe put in a workaround.

推荐答案

如何getLeft()和共达()。在我看来就像这些都是有效的,只要观点并没有被翻译(setTranslationX()和setTranslationY()),这也不能老API中有效。

How about getLeft() and getTop(). Looks to me like these are valid as long as the view hasn't been translated (setTranslationX() and setTranslationY()) which also aren't valid in the older API.

 
精彩推荐