当前位置:网站首页>How to put recyclerview in nestedscrollview- How to put RecyclerView inside NestedScrollView?
How to put recyclerview in nestedscrollview- How to put RecyclerView inside NestedScrollView?
2022-07-07 23:54:00 【Bustling city 】
problem :
With creation of NestedScrollView you can put scrolling view inside another scrolling view as long as those implement NestedScrollingChild and NestedScrollingParent correctly. By creating a NestedScrollView, You can put the scroll view in another scroll view , As long as they are implemented correctly NestedScrollingChild and NestedScrollingParent .
(This is not bad design pattern "Ian Lake (from Google) actually recommends putting a RecyclerView inside a nestedscrollview here: plus.google.com/u/0/+AndroidDevelopers/posts/9kZ3SsXdT2T")( This is a good design pattern “Ian Lake( From Google ) In fact, it is suggested that RecyclerView Put it in nestedscrollview in :plus.google.com/u/0/+AndroidDevelopers/posts/9kZ3SsXdT2T”)
I want to put RecyclerView inside NestedScrollView and fortunately RecyclerView implements NestedScrollingChild so you can put it inside NestedScrollView . I want to put RecyclerView Put it in NestedScrollView Inside , Fortunately, RecyclerView Realized NestedScrollingChild So you can put it in NestedScrollView Inside .
public class RecyclerView extends ViewGroup implements ScrollingView, NestedScrollingChildI have read these posts: I have read these posts :
How to use RecyclerView inside NestedScrollView? How to be in NestedScrollView Use in RecyclerView?
NestedScrolling with NestedScrollView, RecyclerView (Horizontal), inside a CoordinatorLayoutNestedScrolling And NestedScrollView、RecyclerView( level ), stay CoordinatorLayout Inside
But the problem with most voted solution is, it calls all of the items of RecyclerView so for example if it is an endless RecyclerView and when the user reaches the end of the list you want to make a network request then with that solution the RecyclerView calls server repeatedly because it automatically reaches the last item of RecyclerView . But the problem with most voting solutions is , It calls RecyclerView All items , for example , If it is an endless RecyclerView, And when the user reaches the end of the list , You want to make a network request , Then use the solution RecyclerView The calling server repeats , Because it will arrive automatically RecyclerView The last item of .
Anyway, how to set parameter so I can put RecyclerView inside NestedScrollView .(actually I want to put a viewgroup like framelayout or relativelayout as a single childe of nestedscrollview and then I want to put recyclerview inside framelayout or relativelayout) in any case , How to set parameters so that I can set RecyclerView Put it in NestedScrollView .( In fact, I want to be like framelayout or relativelayout Such a view group acts as nestedscrollview A single sub object of , Then I want to recyclerview Put it in framelayout or relativelayout in )
When I put RecyclerView inside NestedScrollView there is nothing to display. When I will RecyclerView Put it in NestedScrollView , There is nothing to show .
In order to create a sample project you can use cheesesquare and change the CheeseDetailActivity to have a RecyclerView. To create it, you can use the sample project cheesesquare And change CheeseDetailActivity Yes RecyclerView.
Although the answer of BNK is not correct but BNK has tried a lot. although BNK Your answer is incorrect , but BNK I have tried a lot .So I award him the bounty. So I gave him a reward .Still looking for nice solution.... Still looking for a good solution ......
Solution :
Reference resources : https://stackoom.com/en/question/2Fqku边栏推荐
- LinkedBlockingQueue源码分析-新增和删除
- C - minute number V3
- 每日刷题记录 (十六)
- Is it safe to buy funds online?
- Chisel tutorial - 03 Combinatorial logic in chisel (chisel3 cheat sheet is attached at the end)
- limit 与offset的用法(转载)
- Seven years' experience of a test engineer -- to you who walk alone all the way (don't give up)
- Database interview questions + analysis
- 【leetcode】day1
- 【LeetCode】20、有效的括号
猜你喜欢
![Binary sort tree [BST] - create, find, delete, output](/img/e4/a950607f8b76bc7f8d56063dd72126.png)
Binary sort tree [BST] - create, find, delete, output

Idea automatically generates serialVersionUID

Get started with mongodb

QT creator add JSON based Wizard

Automated testing: robot framework is a practical skill that 90% of people want to know

【推荐系统基础】正负样本采样和构造
PostGIS learning

Seven years' experience of a test engineer -- to you who walk alone all the way (don't give up)

如何衡量产品是否“刚需、高频、痛点”

MP4文件格式解析之结合实例分析
随机推荐
archery安装测试
Automated testing: robot framework is a practical skill that 90% of people want to know
Les mots ont été écrits, la fonction est vraiment puissante!
Rock-paper-scissors
mysql8.0 ubuntu20.4
Ping error: unknown name or service
【LeetCode】20、有效的括号
Apng2gif solutions to various problems
MP4文件格式解析之结合实例分析
第四期SFO销毁,Starfish OS如何对SFO价值赋能?
Enumeration, simulation, and sorting
P2141 [noip2014 popularization group] abacus mental arithmetic test
Laser slam learning (2d/3d, partial practice)
[path planning] use the vertical distance limit method and Bessel to optimize the path of a star
Learn about scratch
快速回复二极管整流特性
ping报错:未知的名称或服务
Ora-01741 and ora-01704
[summary] some panels and videos seen
数据湖(十五):Spark与Iceberg整合写操作