我做充气布局。我想给布局中的每个项目之间的间距。像下面在充气布局中的每个项目布局之间添加空间android
这是我在XML主代码的图像。父布局
<LinearLayout
android:id="@+id/mLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#F2F2F2"
android:orientation="vertical"
android:padding="2dp"/>
这是我的充气布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="3dp"
android:layout_marginTop="5dp"
android:background="@color/white_pure">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
<TextView
android:layout_width="wrap_content"
android:textSize="9sp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="right"
android:layout_marginRight="5dp"
android:textColor="@color/blueTransfer"/>
</LinearLayout>
我如何做才能像图像(左侧)。在充气布局中的每个项目之间有间距。希望任何人都可以帮助我。
使用余量而不是填充。然后,为每个部分设置背景白色和灰色。 – TruongHieu
如何?我想我已经为每个布局设置了保证金。 huhuu –
你能否提供完整的每个项目视图xml? – TruongHieu