gpt4 book ai didi

android - RecyclerView 在底部加载更多进度条

转载 作者:太空狗 更新时间:2023-10-29 14:48:38 25 4
gpt4 key购买 nike

我尝试实现 addOnScrollListener() 但这个东西每次都从头开始获取数据并加载回收器 View 。我想在当前位置之后加载数据。这是我的示例代码

 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_load, null);

progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE);

myClickHandler();

business_rv = (RecyclerView) view.findViewById(R.id.business_rv);
business = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL,false);
business_rv.setHasFixedSize(true);
business_rv.setLayoutManager(business);
if (business_rv.getLayoutManager() instanceof LinearLayoutManager) {
business = (LinearLayoutManager) business_rv.getLayoutManager();
business_rv.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
UpdateRecyclerView(url);
}
});
}

return view;
}

最佳答案

你需要的是无尽的回收 View ,它会在滚动时加载数据。在这里,我附上了该实现的链接。

Follow this link

关于android - RecyclerView 在底部加载更多进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37230472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com