ShopCarFragment
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--最外层的列表 用来展示商家-->
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/layout" />
<RelativeLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<CheckBox
android:id="@+id/checkbox_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="全选" />
<TextView
android:id="@+id/tv_allprice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/checkbox_all"
android:text="合计:" />
<RelativeLayout
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:background="#d43c3c">
<TextView
android:id="@+id/tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="去结算"
android:textColor="#ffffff"
/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
最外层——ShopCarAdapter
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="30dp">
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/checkbox" />
</RelativeLayout>
<!--展示商家下的商品-->
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/layout" />
</RelativeLayout>
商品——ShopCarItemAdapter
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="100dp">
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/iv_shop"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_toRightOf="@+id/checkbox" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/iv_shop">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#d43c3c" />
<!--自定义加减器-->
<com.bw.zhanshi.view.ShopCarAddView
android:id="@+id/shop_car_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
View布局
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_height="30dp">
<TextView
android:id="@+id/tv_jian"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="-" />
<EditText
android:id="@+id/ed_shop"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/tv_jian"
android:background="@drawable/ed_bg"
android:inputType="number" />
<TextView
android:id="@+id/tv_add"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/ed_shop"
android:gravity="center_horizontal"
android:text="+" />
</RelativeLayout>
</RelativeLayout>