总是五个文件
两个XML和三个JAVA(和正规教程里面把adapter分为adapter和entity两部分了)
先贴两个xml
1:item_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="6dp">
<ImageView
android:id="@+id/item_goods_img"
android:layout_width="50dp"
android:layout_height="50dp"
app:srcCompat="@mipmap/ic_launcher_round" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="vertical">
<TextView
android:id="@+id/item_goods_name"
android:layout_width="match_parent"
android:layout_height="25dp"
android:text="TextView"
android:textSize="15dp" />
<TextView
android:id="@+id/item_goods_price"
android:layout_width="match_parent"
android:layout_height="25dp"
android:text="TextView"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
2:fragment_1.xml
<?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="