1.ListView的使用
运行效果
在Layout布局文件下创建item.xml文件,这里的item.xml文件就是上图中每一个item
在activity_main.xml中使用ListView控件

详细代码:
androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> ListViewandroid:id="@+id/list_main"android:layout_width="0dp"android:layout_height="0dp"android:layout_marginStart="1dp"android:layout_marginEnd="1dp"android:layout_marginBottom="1dp"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toBottomOf="@+id/btn_gridview" /> Buttonandroid:id="@+id/btn_gridview"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!