【问题标题】:recyclerview can't display list more then 7recyclerview 不能显示超过 7 个列表
【发布时间】:2023-03-19 16:47:02
【问题描述】:

recyclerview 不能显示超过 7 个的列表

【问题讨论】:

  • 请重新格式化您的帖子。此外,发布您的观点也可能很有用。

标签: java android mobile fragment


【解决方案1】:

Android 的回收器视图通过getItemCount 方法获取要显示的元素数量。

由于getItemCount返回7,因为images数组中有7个元素,所以只显示了7个元素。

【讨论】:

    【解决方案2】:

    图像数组计数只有 7 个。

    【讨论】:

      【解决方案3】:

      由于 Arun 已经回答了您的问题,您仍然需要了解更多详细信息。

      你说怎么显示recyclerview超过7, 为此,只需在图像数组中添加更多项目: 将图像数组替换为以下内容。

      int images [] = {R.drawable.greasy_fast_food,R.drawable.greasy_fast_food,R.drawable.greasy_fast_food,
                  R.drawable.greasy_fast_food,R.drawable.greasy_fast_food,R.drawable.greasy_fast_food,R.drawable.greasy_fast_food , R.drawable.greasy_fast_food,R.drawable.greasy_fast_food,R.drawable.greasy_fast_food};
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-02-14
        • 2018-02-24
        • 1970-01-01
        • 1970-01-01
        • 2015-05-03
        相关资源
        最近更新 更多