onCreateViewHolder

This implementation is quite straightforward. We will inflate the XML layout that we defined for the individual articles, and find the views that will be used to display the information:

override fun onCreateViewHolder(parent: ViewGroup,
viewType: Int): ViewHolder {
val layout = LayoutInflater.from(parent.context)
.inflate(R.layout.article, parent, false) as LinearLayout

val feed = layout.findViewById<TextView>(R.id.feed)
val title = layout.findViewById<TextView>(R.id.title)
val summary = layout.findViewById<TextView>(R.id.summary)

return ViewHolder(layout, feed, title, summary)
}

Now each time a new ViewHolder is needed, this function will be called.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.178.151