android:layout_marginLeft是指父视图还是周围的视图?

时间:2016-08-29 12:02:23

标签: android android-layout

我设置了android:layout_marginLeft属性,我不明白它是否会保留父母或旁边的下一个视图的距离/边距?

Doc只说:Specifies extra space on the left side of this view. This space is outside this view's bounds. Margin values should be positive.

2 个答案:

答案 0 :(得分:1)

取决于父级布局。

如果它是LinearLayoutRelativeLayoutTableRow,那么android:layout_marginLeft属性将在同一父视图的上一个孩子的左侧指定额外空间层次结构(周围的视图)。

如果它是FrameLayout,则android:layout_marginLeft属性将在其父级的左侧指定额外空间。它不会受到同一父母的其他孩子的影响。

答案 1 :(得分:0)

它将在父LayoutGroup

中设置该视图的边距