My RecyclerView
does not call onCreateViewHolder
, onBindViewHolder
even MenuViewHolder
constructor, therefore nothing app
In my case I miss to set the orientation in my LinearLayout.
After adding orientation issue fixed.
android:orientation="vertical"
My mistake was inflating the wrong view in Fragment onCreateView.
My problem was layout_height
and layout_width
of the RecyclerView set to 0dp
.
If you put wrap_content as height of your list as well as the height of your item list, nothing will show up and none of your recyclerView functions will be called. Fix the height of the item or put match_parent for the list height. That solved my problem.
I had an issue because i setup the layout by myself and have put
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/band_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.recyclerview.widget.RecyclerView>
and
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/band_recycler_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:textAlignment="center">
resolved my issue
Other option is if you send this list objetc using get,verify if you have correct reference,for example
private list<objetc> listObjetc;
//Incorrect
public void setListObjetcs(list<objetc> listObjetc){
listObjetc = listObjetc;
}
//Correct
public void setListObjetcs(list<objetc> listObjetc){
this.listObjetc = listObjetc;
}