gravity的start、end

来源:互联网 发布:大数据实时查询 编辑:程序博客网 时间:2024/05/16 09:37

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

文档上是这么说的:

left0x03Push object to the left of its container, not changing its size.start0x00800003Push object to the beginning of its container, not changing its size.end0x00800005Push 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仅表示水平方向上的开始和结束位置。

0 0