【发布时间】:2013-11-20 16:10:21
【问题描述】:
我想知道是否可以在父级中定义子级的边距。
像这样:
<LinearLayout
childrenMargin="10dp"
>
<child />
<child />
<child />
</LinearLayout>
还是我必须为儿童设置layout_margin?
【问题讨论】:
标签: android xml layout styles margin
我想知道是否可以在父级中定义子级的边距。
像这样:
<LinearLayout
childrenMargin="10dp"
>
<child />
<child />
<child />
</LinearLayout>
还是我必须为儿童设置layout_margin?
【问题讨论】:
标签: android xml layout styles margin
听起来您想为父元素添加内边距。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp" >
...
</LinearLayout>
一种思考方式是,padding 是 View 的内部间距(即它与其子项之间的间距),而 margin 是 View 的外部间距(它与其父级和邻居之间的空间)。
【讨论】: