Issue
Hello I am using recyclerView, I've just watched in a tutorial that they use this
Inside a recyclerView override functions when this is called
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)
}
And bring R.layout.rowlayout
and in this layout is the following code
The thing is that in the header, it does not call
androidx.constraintlayout.widget.ConstraintLayout
or LinearLayout
instead of that call this code app:com.example.perri.rowlayout
that will bring the Kotlin file
I'd like to know how this kind of approach called, thank you !
Solution
This type of classes are Custom View Components
Android offers a number of predefined layouts and widgets, such as LinearLayout
, ConstainLayout
, Button
, etc.
If these components don't meet your needs, you can create your own to change their appearance or behavior.
There are several approaches, in your example you are Modifying an Existing View Type, to create a custom ConstraintLayout
, and use it as the row layout of the recyclerView
.
Answered By - Stefano Sansone