Home > Enterprise >  How is called this type of implementation? RecyclerView, Layout
How is called this type of implementation? RecyclerView, Layout

Time:09-27

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 enter image description here 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 KotlinFile enter image description here

I'll like to know how this kind of approach called, Thank you !

CodePudding user response:

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.

  • Related