从零开始学习RecyclerView

1、实现最简单的一个控件列表

<?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:orientation="vertical"
    tools:context=".MainActivity">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>

item

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/textView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="16dp"
    android:textSize="18sp"/>

java代码:看效果

暂停

相关推荐

  1. 开始学习MySQL

    2024-06-12 07:04:04       31 阅读
  2. 开始学习Linux》——开篇

    2024-06-12 07:04:04       28 阅读
  3. 开始学习MySQL 事务处理

    2024-06-12 07:04:04       25 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-12 07:04:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-12 07:04:04       100 阅读
  3. 在Django里面运行非项目文件

    2024-06-12 07:04:04       82 阅读
  4. Python语言-面向对象

    2024-06-12 07:04:04       91 阅读

热门阅读

  1. unity text根据文本内容自动设置高度

    2024-06-12 07:04:04       35 阅读
  2. 【镜像制作】node.js+pm2的latest版镜像制作

    2024-06-12 07:04:04       32 阅读
  3. 快人一步!利用LLM实现数据处理自动化

    2024-06-12 07:04:04       32 阅读
  4. 特别名词Text Paper4

    2024-06-12 07:04:04       26 阅读
  5. ioctlsocket

    2024-06-12 07:04:04       30 阅读
  6. 密码加密存储

    2024-06-12 07:04:04       29 阅读
  7. 如何用css实现两列布局?

    2024-06-12 07:04:04       33 阅读
  8. 哨兵机制(Redis Sentinel)常见面试题

    2024-06-12 07:04:04       28 阅读
  9. 【C#】IndexOf的使用

    2024-06-12 07:04:04       32 阅读
  10. 二十、OOP之理解《匿名内部类》

    2024-06-12 07:04:04       28 阅读