NestedScrollView
끝에 EndlessRecyclerView
이 있습니다. EndlessRecyclerView
의미 : 사용자가 recyclerView의 맨 아래로 스크롤하면 더 많은 데이터가로드됩니다. 이것은 이미 구현되어 있고 다른 곳에서 작업하고 있지만 NestedScrollView
안에는 recyclerView를 넣을 때 OnScrollListener
이벤트가 실행되지 않습니다.RecyclerView NestedScrollView 내부의 ScrollListener
XML 디자인 :
<NestedScrollView>
<Other views/>
<EndlessRecyclerView/>
</NestedScrollView >
코드 :
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
// This is never fired! Here is where I implement the logic of EndlessRecyclerView
}
});
가 어떻게 위의 경우에 대한 스크롤 이벤트를받을 수 있나요?
서로 내부에 스크롤 가능한 두 개의보기가있는 것이 좋지 않다는 것을 알고 있습니다. 그러나 스크롤 가능한 뷰가 두 개 없어도 위의 경우를 어떻게 가질 수 있습니까?
는 이미이 링크를 따라했지만 작동하지 않습니다 scroll event for recyclerview inside scrollview android
멋진 남자가 내가 보내는 하루 종일 심각 두 라인을 만들어이를 해결한다. 위대한 하나 ...하지만 지금은 어떻게 보이는 항목을 얻을 수있는 모든 서버에 새 레코드를 가져올 수 있습니까? –
@RahulVats 위의 코드에서 if 조건이 충족되면 사용자가 완전히 스크롤하고 마지막 항목을 볼 수 있음을 의미합니다. 100 개의 항목이 있으며 처음에는 20 개의 항목이로드되었다고 가정 해 보겠습니다. 위의 조건이 충족되면 서버에서 다음 데이터 세트 (예 : 21-40)를 다운로드 할 수 있습니다. 어쨌든이 실제 검색어를 보려면 다음 링크를 참조하십시오. https://stackoverflow.com/questions/40726438/android-detect-when-the-last-item-in-a-recyclerview-is-visible?noredirect=1&lq= 1 – Govind