What does offsetLeftAndRight() exactly do?

2019-04-22 16:50发布

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条回答
甜甜的少女心
2楼-- · 2019-04-22 17:36

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.

查看更多
登录 后发表回答