在这两种方法的上下文中,屏幕和视图有什么不同?
我有一个按钮,我想要得到它中心的x坐标。
我想这就足够了:
public int getButtonXPosition() {
return (button.getLeft()+button.getRight())/2;
}
但是,如果我使用了
getLocationOnScreen()
还是getLocationInWindow()
?
(当然,再加上按钮宽度的一半)
https://stackoverflow.com/questions/17672891
复制相似问题