安卓相当于解决类似的View.getX()API 11日之前? [英] Android equivalent work-around for View.getX() before API 11?

查看:119
本文介绍了安卓相当于解决类似的View.getX()API 11日之前?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的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.

这篇关于安卓相当于解决类似的View.getX()API 11日之前?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆