I have a RecyclerView that contains a list of integers for which I want to calculate and set the width. Here is the method I use to do this:
private void UpdateRoundNumbers()
{
(this.rvRoundNumbers.GetAdapter() as RoundNumbersAdapter).RoundNumbers.Add(this.rvRoundNumbers.GetAdapter().ItemCount + 1);
this.rvRoundNumbers.GetAdapter().NotifyItemInserted(this.rvRoundNumbers.GetAdapter().ItemCount - 1);
TextView tv = new TextView(Application.Context, null, 0, Resource.Style.ItemTextView);
this.rvRoundNumbers.LayoutParameters.Width = (int)Enumerable.Range(1, ScorePadApplication.Players.Max((pd) => pd.Scores.Count) + 1).Max((roundnumber) => { return tv.Paint.MeasureText(roundnumber.ToString()); }) + tv.PaddingStart + tv.PaddingEnd;
}
However, the RecyclerView (the black column on the left in the screenshots) is not always displaying the added values, even though I call NotifyItemInserted. I have confirmed that the value calculated by the method is correct even when it does not display the new values, and when one value is not displayed, that continues for the rest of the debugging session. Here are screenshots of when it works & doesn't work:


I change no code between debug sessions, and yet it still happens inconsistently (the two screenshots were taken back to back by doing nothing other than starting a new debug session). What could be causing something like this? Thanks.