美文网首页
布局中的android:layout_alignStart含义

布局中的android:layout_alignStart含义

作者: 白天才痴 | 来源:发表于2015-12-24 12:05 被阅读7013次

在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

相关文章

网友评论

      本文标题:布局中的android:layout_alignStart含义

      本文链接:https://www.haomeiwen.com/subject/wxmvhttx.html