布局中的android:layout_alignStart含义

在android studio里用相对布局时,用到android:layout_toLeftOf时,会被提醒使用android:layout_alignStart更好,换了之后从效果上看并没有什么变化,也不理解这里说的start是什么意思。developer上解释也没多说什么。

Positions the end edge of this view to the start of the given anchor view ID. Accommodates end margin of this view and start margin of anchor view.
Must be a reference to another resource, in the form "@[+][*package*:]*type*:*name*
" or to a theme attribute in the form "?[*package*:][*type*:]*name*
".
This corresponds to the global attribute resource symbol [layout_toStartOf](http://developer.android.com/reference/android/R.attr.html#layout_toStartOf)
.

不过从android studio的tips里看到了原因,使用android:layout_alignStart为了本地化的原因,因为有些国家的文字是从右向左的。使用android:layout_alignStart就可以解决这种本地化的情况了。这个特性就是android从api17开始支持的RTL。

Paste_Image.png

http://android-developers.blogspot.com/2013/03/native-rtl-support-in-android-42.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容