Android7.0中文文档 --- RelativeLayout

来源:互联网 发布:宁波市软件行业协会 编辑:程序博客网 时间:2024/05/17 06:07

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/RelativeLayout.html

RelativeLayout

public class RelativeLayout
extendsViewGroup

java.lang.Object   ↳android.view.View    ↳android.view.ViewGroup     ↳android.widget.RelativeLayout
已知的直接子类


A Layout where the positions of the children can be described in relation to each other or to the parent.
在一个布局中,子项的位置可以被描述成与彼此或与父项之间的关系。

Note that you cannot have a circular dependency between the size of the RelativeLayout and the position of its children. For example, you cannot have a RelativeLayout whose height is set toWRAP_CONTENT and a child set toALIGN_PARENT_BOTTOM.
注意,你不能在的RelativeLayout大小和其子项位置之间有一个循环依赖关系。例如,你不能有一个设置了WRAP_CONTENT的RelativeLayout,并且将一个子项设置为ALIGN_PARENT_BOTTOM

Note: In platform version 17 and lower, RelativeLayout was affected by a measurement bug that could cause child views to be measured with incorrectMeasureSpec values. (SeeMeasureSpec.makeMeasureSpec for more details.) This was triggered when a RelativeLayout container was placed in a scrolling container, such as a ScrollView or HorizontalScrollView. If a custom view not equipped to properly measure with the MeasureSpec modeUNSPECIFIED was placed in a RelativeLayout, this would silently work anyway as RelativeLayout would pass a very largeAT_MOST MeasureSpec instead.
注意:在17或更低的平台版本中,相对布局受到一个测量bug的影响,它可能导致子视图以不正确的MeasureSpec来测量。(参考MeasureSpec.makeMeasureSpec获取更详细的信息)。当把一个RelativeLayout容器放置到一个滚动容器(如ScrollView或HorizontalScrollView)中时,这个bug将被触发。如果放置在RalativeLayout中的自定义视图使用UNSPECIFIED的MeasureSpec的模式而没有设置适当的测量,它也能工作,但是RelativeLayout会传入一个非常大的AT_MOST MeasureSpec。

This behavior has been preserved for apps that set android:targetSdkVersion="17" or older in their manifest'suses-sdk tag for compatibility. Apps targeting SDK version 18 or newer will receive the correct behavior
这种行为是为了应用程序在manifest的uses-sdk标签中设置android:targetSdkVersion="17"或更老版本中的兼容。18或更新的版本的应用程序将会得到正确的行为

See the Relative Layout guide.
请参考Relative Layout指南。

Also see RelativeLayout.LayoutParams for layout attributes
参考RelativeLayout.LayoutParams了解布局属性。

摘要


嵌套类

classRelativeLayout.LayoutParams

Per-child layout information associated with RelativeLayout. 
与RelativeLayout相关的每个子布局的信息。 

XML属性

android:gravity在一个对象自身的边界内,它如何在x轴和y坐标轴上放置其内容。 android:ignoreGravity不受重力值影响的视图。 

继承XML属性

原创粉丝点击