RecyclerView StaggeredGridLayoutManager FindFirstVisibleItemPositions 始终为 0 (androidx)

Posted

技术标签:

【中文标题】RecyclerView StaggeredGridLayoutManager FindFirstVisibleItemPositions 始终为 0 (androidx)【英文标题】:RecyclerView StaggeredGridLayoutManager FindFirstVisibleItemPositions always is 0 (androidx) 【发布时间】:2019-10-21 14:39:58 【问题描述】:

我想尝试staggeredGridLayoutManagerrecyclerView 中的延迟加载,但是FindFirstVisibleItemPositions 函数找不到第一个可见项目位置,它总是返回 0 和 1(我有 2 列),并且onScrolled 将在 init 处触发。

我使用androidx.recyclerview.widget

我的代码

StaggeredGridLayoutManager m = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(m);
recyclerView.setAdapter(new MyAdapter());
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() 
                            @Override
                            public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) 
                                super.onScrollStateChanged(recyclerView, newState);
                                int visibleItemCount = m.getChildCount();;
                                int totalItemCount = m.getItemCount();
                                int[] firstVisibleItemPosition = m.findFirstVisibleItemPositions(null);
                                Log.i("DebugMessage", "-----------onScrollStateChanged-----------");
                                Log.i("DebugMessage", "newState: " + newState);
                                Log.i("DebugMessage","visibleItemCount:" + visibleItemCount);
                                Log.i("DebugMessage","totalItemCount:" + totalItemCount);
                                for(int i = 0;i<firstVisibleItemPosition.length;i++)
                                
                                    Log.i("DebugMessage","firstVisibleItemPosition:" + firstVisibleItemPosition[i]);
                                
                            

                            @Override
                            public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) 
                                super.onScrolled(recyclerView, dx, dy);
                                Log.i("DebugMessage", "-----------onScrolled-----------");
                                Log.i("DebugMessage", "dx: " + dx);
                                Log.i("DebugMessage", "dy: " + dy);
                            
                        );

结果

2019-06-06 13:21:36.700 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrolled-----------
2019-06-06 13:21:36.700 26282-26282/com.sample.lazyloading I/DebugMessage: dx: 0
2019-06-06 13:21:36.700 26282-26282/com.sample.lazyloading I/DebugMessage: dy: 0
2019-06-06 13:21:47.793 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:47.794 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:47.794 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:47.794 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:47.794 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:47.794 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:48.482 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:48.482 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:21:48.482 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:48.482 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:48.482 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:48.482 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:51.779 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:51.779 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:51.779 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:51.779 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:51.780 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:51.780 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:52.399 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:52.399 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:21:52.399 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:52.400 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:52.400 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:52.400 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:53.086 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:53.086 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:53.086 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:53.087 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:53.087 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:53.087 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:53.563 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:53.563 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:21:53.563 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:53.563 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:53.564 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:53.564 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:54.218 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:54.218 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:54.219 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:54.219 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:54.219 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:54.219 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:54.702 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:54.703 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:21:54.703 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:54.703 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:54.703 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:54.703 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:55.508 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:55.508 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:55.508 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:55.508 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:55.508 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:55.508 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:55.931 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:55.931 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:21:55.931 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:55.931 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:55.931 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:55.931 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:56.531 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:56.531 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:56.531 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:56.531 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:56.532 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:56.532 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:56.993 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:56.993 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:21:56.993 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:56.993 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:56.993 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:56.993 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:57.096 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:57.097 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:21:57.097 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:57.097 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:57.097 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:57.097 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:57.496 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:57.496 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:57.496 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:57.496 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:57.496 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:57.496 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:57.592 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:57.592 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:21:57.592 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:57.592 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:57.593 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:57.593 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:58.060 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:58.061 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:58.061 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:58.061 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:58.061 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:58.061 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:58.133 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:58.133 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:21:58.133 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:58.133 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:58.133 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:58.133 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:58.696 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:58.696 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:58.696 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:58.696 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:58.696 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:58.697 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:58.768 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:58.768 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:21:58.768 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:58.768 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:58.768 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:58.768 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:59.437 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:59.437 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:21:59.437 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:59.437 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:59.437 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:59.437 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:21:59.519 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:21:59.519 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:21:59.519 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:21:59.519 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:21:59.519 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:21:59.519 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:00.013 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:00.013 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:22:00.013 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:00.013 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:00.013 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:00.013 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:00.087 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:00.088 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:22:00.088 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:00.088 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:00.088 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:00.088 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:00.590 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:00.591 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:22:00.591 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:00.591 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:00.591 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:00.591 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:00.665 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:00.665 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:22:00.665 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:00.665 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:00.665 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:00.665 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:02.176 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:02.176 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:22:02.176 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:02.176 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:02.176 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:02.176 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:14.009 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:14.009 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 1
2019-06-06 13:22:14.009 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:14.009 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:14.009 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:14.009 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:14.444 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:14.444 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 2
2019-06-06 13:22:14.445 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:14.445 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:14.445 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:14.445 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1
2019-06-06 13:22:14.825 26282-26282/com.sample.lazyloading I/DebugMessage: -----------onScrollStateChanged-----------
2019-06-06 13:22:14.825 26282-26282/com.sample.lazyloading I/DebugMessage: newState: 0
2019-06-06 13:22:14.825 26282-26282/com.sample.lazyloading I/DebugMessage: visibleItemCount:30
2019-06-06 13:22:14.825 26282-26282/com.sample.lazyloading I/DebugMessage: totalItemCount:30
2019-06-06 13:22:14.825 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:0
2019-06-06 13:22:14.825 26282-26282/com.sample.lazyloading I/DebugMessage: firstVisibleItemPosition:1

【问题讨论】:

试试这个 -> int[] firstVisiblePosition = manager.findFirstVisibleItemPosition(null)[0]; StaggeredGridLayoutManager没有findFirstVisibleItemPosition方法,只有findFirstVisibleItemPositions,manager.findFirstVisibleItemPositions(null)[0]总是为0 是的,我忘了那个额外的“s”,我的错。无论如何,我会在这里尝试一下并尽快添加答案。 【参考方案1】:

我找到了原因,因为我在recycleview parent 使用了nestedscrollview。

【讨论】:

以上是关于RecyclerView StaggeredGridLayoutManager FindFirstVisibleItemPositions 始终为 0 (androidx)的主要内容,如果未能解决你的问题,请参考以下文章

RecyclerView详解

RecyclerView

RecyclerView嵌套RecyclerView问题

RecyclerView小结

RecyclerView系列:RecyclerView嵌套RecyclerView(BaseRecyclerViewAdapterHelper实现)

recyclerview怎么监听滑动事件