gravity中的start和end

在AndroidStudio中,在布局中写下gravity=“left|bottom”时,会提示将left替换为start。why?它们的不同点是啥?

文档上是这么说的:

left 0x03 Push object to the left of its container, not changing its size.
start 0x00800003 Push object to the beginning of its container, not changing its size.
end 0x00800005 Push object to the end of its container, not changing its size.
完全看不出有什么不同。后来经Google一番,终于弄明白,left和right代表一种绝对的对齐,而start和end表示基于阅读顺序的对齐。
主要的阅读顺序有两种:从左向右(LTR)和从右向左(RTL)(中国古代是从上到下…)。

当使用left的时候,无论是LTR还是RTL,总是左对齐的;而使用start,在LTR中是左对齐,而在RTL中则是右对齐。

目前,android还不考虑到中国古代从上到下的这种阅读顺序,start和end仅表示水平方向上的开始和结束位置。

转载自:https://blog.csdn.net/tiewen/article/details/39925239

猜你喜欢

转载自blog.csdn.net/callmeMrLu/article/details/82025908
今日推荐