What does offsetLeftAndRight() exactly do?

孤者浪人 提交于 2019-12-22 04:08:10

问题


What does offsetLeftAndRight() exactly do? Documentation says: "Offset this view's horizontal location by the specified amount of pixels" So, does it mean that if the view's left position is suppose 50 and offsetLeftAndRight(20) is called on it, then the view will move by 20pixels & its left position will be (50-20) i.e. 30?

Thanks in advance.


回答1:


Both the left and the right positions will be incremented by the offset. So in your example, the left position will change to 50 + 20 = 70.



来源:https://stackoverflow.com/questions/12590664/what-does-offsetleftandright-exactly-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!