<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="vertical"
tools:context="com.xg.xgshopcartdemo.MainActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/recycleview"></android.support.v7.widget.RecyclerView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.8"
android:id="@+id/ll_selectAll"
android:layout_marginLeft="20dp">
<ImageView
android:layout_width="30dp"
android:layout_height="match_parent"
android:id="@+id/iv_selectAll"
android:src="@drawable/shopcart_selected"/>
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:gravity="center"
android:id="@+id/tv_selectAll"
android:text="全选"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:layout_weight="1"
android:id="@+id/tv_allPrice"
android:textColor="@android:color/holo_red_dark"
android:text="总价:17.0元"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:id="@+id/tv_allGoodsNum"
android:layout_weight="1"
android:text="共4件商品"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.9">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:id="@+id/btn_commit"
android:textColor="@android:color/holo_red_dark"
android:text="去结算"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
1.2,其次我们还得画一个布局,即里面Item的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--shop-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/ll_shopcart_header"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/shopcart_selected"
android:id="@+id/iv_shopSelect"
android:layout_marginLeft="20dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/iv_shopImag"
android:src="@drawable/shopcart_entershop"
android:layout_marginLeft="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:id="@+id/tv_shopName"
android:text="XX店铺"/>
</LinearLayout>
<!--goods-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:layout_marginLeft="50dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/iv_goodsSelect"
android:src="@drawable/shopcart_selected" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginLeft="70dp"
android:gravity="center_vertical"
android:id="@+id/tv_goodsName"
android:text="商品名称"/>
<TextView
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginLeft="70dp"
android:gravity="center_vertical|right"
android:id="@+id/tv_goodsPrice"
android:textColor="@android:color/holo_red_dark"
android:text="¥1.0"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_marginLeft="70dp"
![](https://img2020.cnblogs.com/blog/1962547/202011/1962547-20201118154203794-805143294.jpg)