主布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<include layout="@layout/tiltle"></include>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
>
<com.bawei.day17.view.MyExpandableListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:id="@+id/exlistview"
>
</com.bawei.day17.view.MyExpandableListView>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="8"
android:layout_marginLeft="10dp"
>
<CheckBox
android:layout_width="30dp"
android:layout_height="20dp"
android:id="@+id/check"
android:layout_centerVertical="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checked"
android:text="已选(0)"
android:textSize="20sp"
android:layout_toRightOf="@id/check"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
/>
<Button
android:layout_width="80dp"
android:layout_height="50dp"
android:text="下单"
android:textSize="20sp"
android:layout_centerVertical="true"
android:textColor="#fff"
android:id="@+id/xiadan"
android:layout_alignParentRight="true"
android:background="#f00"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sum"
android:text="¥0.00"
android:textSize="22sp"
android:textColor="#f00"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@id/xiadan"
android:layout_centerVertical="true"
/>
</RelativeLayout>
</LinearLayout>
父类布局
<?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:background="#66363636"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/parent_title"
android:textSize="20sp"
android:textColor="#000"
android:layout_marginLeft="10dp"
android:text="22222"
/>
</LinearLayout>
子类布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="30dp"
android:layout_height="30dp"
android:id="@+id/soncheck"
android:layout_margin="5dp"
android:layout_centerVertical="true"
/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:padding="10dp"
android:layout_toRightOf="@id/soncheck"
android:id="@+id/sonion"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/sontitle"
android:layout_toRightOf="@id/sonion"
android:layout_marginLeft="5dp"
android:textSize="20sp"
android:text="1111"
android:layout_alignTop="@id/sonion"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Nowprice"
android:text="2222"
android:layout_alignBottom="@id/sonion"
android:layout_toRightOf="@id/sonion"
android:textSize="20sp"
android:layout_marginLeft="10dp"
android:textColor="#f00"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/oldprice"
android:textSize="18dp"
android:text="333"
android:layout_toRightOf="@id/Nowprice"
android:layout_alignBottom="@id/Nowprice"
android:layout_marginLeft="10dp"
/>
<Button
android:layout_width="40dp"
android:layout_height="40dp"
android:id="@+id/jian"
android:text="-"
android:layout_toRightOf="@id/oldprice"
android:layout_below="@id/sontitle"
android:layout_marginLeft="40dp"
/>
<TextView
android:layout_width="40dp"
android:layout_height="40dp"
android:id="@+id/content"
android:text="1"
android:layout_toRightOf="@id/jian"
android:layout_alignBottom="@id/jian"
android:gravity="center"
/>
<Button
android:layout_width="40dp"
android:layout_height="40dp"
android:id="@+id/jia"
android:layout_toRightOf="@id/content"
android:text="+"
android:layout_below="@id/sontitle"
/>
</RelativeLayout>
//标题
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_arrow_back_black_24dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="购物车"
android:textSize="30sp"
android:textStyle="bold"
android:layout_centerInParent="true"
/>
</RelativeLayout>