layoutmanager.FindFirstCompletelyVisibleItemPosition always returns -1
<p>I have a recyclerview in my android project which displays media contents within each view. What I'm trying to achieve is that I'm able to play/pause media as I scroll up and down. I need to get the adapter position of the completely visible view. I'm doing something like this.</p>

<p>In my activity fragment I have this:</p>

<pre><code>        layoutmanager = new LinearLayoutManager(Activity);

        adapter = new FeedAdapter(vid, userName, this.Context);

        feeditem.SetLayoutManager(layoutmanager);
        feeditem.SetAdapter(adapter);

        var onScrollListener = new XamarinRecyclerViewOnScrollListener(Activity, layoutmanager, adapter);
</code></pre>

<p>The scroll listener event looks like this:</p>

<pre><code>public override void OnScrollStateChanged(RecyclerView recyclerView, int newState)
    {
        base.OnScrollStateChanged(recyclerView, newState);

        if (newState == (int)ScrollState.Idle)
        {
            layoutmanager = (LinearLayoutManager)recyclerView.GetLayoutManager();

            int firstVisiblePosition = layoutmanager.FindFirstCompletelyVisibleItemPosition();
            int visible = layoutmanager.FindFirstVisibleItemPosition();
            int last = layoutmanager.FindLastVisibleItemPosition();
            if (firstVisiblePosition &gt;= 0)
            {
                if (oldFocusedLayout != null)
                {
                    Toast.MakeText(ctx, "Stop Video", ToastLength.Long).Show();
                }


            }
            currentFocusedLayout = layoutmanager.FindViewByPosition(firstVisiblePosition);

            Toast.MakeText(ctx, "Play video", ToastLength.Long).Show();

            oldFocusedLayout = currentFocusedLayout;

        }
    }

        feeditem.AddOnScrollListener(onScrollListener);
</code></pre>

<p>The issue is that the linearlayout manager method <code>FindFirstCompletelyVisibleItemPosition</code> always returns -1 even when the view is completely visible. Other methods like <code>FindFirstVisibleItemPosition</code> and <code>FindLastVisibleItemPosition</code> gives the correct position of the view. </p>

<p>Any idea what might be the issue here? </p>