question

njsokalski avatar image
0 Votes"
njsokalski asked RobCaplan edited

RecyclerView Data Not Displayed

I have a RecyclerView whose data is not being displayed. Here is the code I use to set the LayoutManager & Adapter:

 this.rvNewScoreCardOne.SetLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.Vertical, false));
 this.rvNewScoreCardOne.SetAdapter(new ScoreTypeAdapter(Enumerable.Range(0, 6).Select((scoretype) => { return ((AlhambraScoreType)scoretype, new int[] { }); }).ToList()));
 this.rvNewScoreCardOne.GetAdapter().NotifyDataSetChanged();

The Adapter is very basic. I have also used this same Adapter (and the xml layout file in it) in several other places in my app. The only differences I am aware of with this RecyclerView is that it is in a layout file used by an include tag rather being directly in the main layout file, and the include tag is inside a ScrollView. I will, however, note that I have another RecyclerView directly beside this one (inside the same GridLayout, just a different column) which shows fine. I will also note that this RecyclerView (the one that is not showing) has a layout_columnWeight of 1. The background of the RecyclerView displays, so I know that it is there. What could be the problem? Thanks.

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I notice you use this.rvNewScoreCardOne.GetAdapter().NotifyDataSetChanged(); to notify recycleview, Please try to use mAdapter = new DataAdapter(list, getContext()); rv.SetAdapter(mAdapter); mAdapter.NotifyDataSetChanged();

0 Votes 0 ·

0 Answers