What Does The Field Itemview Of Type View In Viewholder Reference?
I am trying to figure out what the field itemView actually is. Here is the code snippet I taken from the documentation. public abstract static class ViewHolder { @NonNull
Solution 1:
It totally depends on your code as it refers the itemView
when you calls new SomeViewHolder(itemView)
.
For example, in the code of Android Guide - Create a List with RecyclerView - Add a list adapter MyViewHolder have a reference of a TextView v
after created.
public MyAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
// create a new viewTextViewv= (TextView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.my_text_view, parent, false);
...
MyViewHoldervh=newMyViewHolder(v);
return vh;
}
Post a Comment for "What Does The Field Itemview Of Type View In Viewholder Reference?"