这种实现方式怎么称呼? RecyclerView,布局

How is called this type of implementation? RecyclerView, Layout

您好,我正在使用 recyclerView,我刚刚在教程中看到他们使用这个

在 recyclerView 覆盖函数中 当这被称为

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
    val v = LayoutInflater.from(parent.context).inflate(R.layout.rowlayout, parent, false  )
    //esto lo unimo al marco estandar de noticias
    return ViewHolder(v)

}

并带来R.layout.rowlayout

在此布局中是以下代码

问题是在 header 中,它不会调用 androidx.constraintlayout.widget.ConstraintLayoutLinearLayout 而不是调用此代码 app:com.example.perri.rowlayout 将带来 Kotlin 文件

想知道这种方法怎么调用,谢谢!

这类类是Custom View Components

Android 提供了许多预定义的布局和小部件,例如 LinearLayoutConstainLayoutButton 等。 如果这些组件不能满足您的需要,您可以创建自己的组件来更改它们的外观或行为。

有几种方法,在您的示例中您是 Modifying an Existing View Type,创建自定义 ConstraintLayout,并将其用作 recyclerView 的行布局。