我有3个子视图的水平线性布局。
我想使中间孩子水平居中,并将其兄弟姐妹的侧面朝外8dps。
这是干净的方法吗?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end"
android:orientation="horizontal">
<include
android:id="@+id/child1"
layout="@layout/child1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|end"
android:maxLines="1" />
<include
android:id="@+id/child2"
layout="@layout/child2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/separator_horizontal_margin"
android:layout_marginLeft="@dimen/separator_horizontal_margin"
android:layout_marginEnd="@dimen/separator_horizontal_margin"
android:layout_marginRight="@dimen/separator_horizontal_margin" />
<include
android:id="@+id/child3"
layout="@layout/child3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|start"
android:maxLines="1" />
</LinearLayout>