【问题标题】:why i am getting error in recyclerView.layoutmanager=linearlayout为什么我在 recyclerView.layoutmanager=linearlayout 中出现错误
【发布时间】:2021-11-23 16:11:11
【问题描述】:

[这是我的代码][1]

[1]:https://i.stack.imgur.com/uoq`valrecyclerView = findViewById(R.id.recyclerView) recyclerView.layoutManager=LinearLayoutManager(这个) `xi.png

【问题讨论】:

    标签: android android-studio kotlin


    【解决方案1】:

    您必须推断findViewById 方法的正确类型,否则recyclerview 变量将是通用View 而不是RecyclerView

    val recyclerView = findViewById<RecyclerView>(R.id.recyclerView)
    

    【讨论】:

      猜你喜欢
      • 2014-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 2021-11-09
      • 2020-11-27
      • 1970-01-01
      相关资源
      最近更新 更多