我想换ListView到RecyclerView.我想使用onScroll的的OnScrollListener在RecyclerView确定用户滚动到列表的末尾.
如何知道用户是否滚动到列表末尾以便我可以从REST服务获取新数据?
android listview onscrolllistener material-design android-recyclerview
我需要创建一个垂直的Recyclerview,其中应调整屏幕中心的项目视图,以便在滚动时具有缩放效果.
我尝试但没有奏效的事情:
添加滚动侦听器并按位置循环浏览项目视图,测量居中位置,然后更新LayoutParams居中view.
RecyclerView在滚动时不会计算项目的位置或更新视图.IllegalStateException如果执行此类操作,则抛出onScrolledLayoutParams在onScrollStateChanged滚动状态下更改居中的项目视图是IDLE或SETTLING.
最后的选择仍然是实现自己的自定义LayoutManager,将扩展默认LayoutManager.
Layoutmanager涉及处理需要处理的更复杂的计算.任何其他解决方案或想法将不胜感激.
java performance android android-layout android-recyclerview
这可能是重复的,但仍然没有正确的答案.我提到了这个,这个和这个
如链接中所述,我希望实施循环的回收视图,即
[查看1] - [查看2] ....- [查看N-1] - [查看N] - [查看1] .....等等
由于没有覆盖方法来获取View并在recyclerview中获取Item,因此我无法成功.
请帮忙.谢谢!
我的回收器适配器代码
public class HorizontalRecyclerAdapter extends RecyclerView.Adapter<HorizontalRecyclerAdapter.ProductViewHolder> {
List<Product> products;
private Context mContext;
ImageLoader imageLoader;
HorizontalRecyclerAdapter(List<Product> products, Context mContext) {
this.products = products;
this.mContext = mContext;
}
@Override
public ProductViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.product_layout, parent, false);
return new ProductViewHolder(v);
}
@Override
public void onBindViewHolder(final ProductViewHolder holder, int position) {
imageLoader = SingletonRequestQueue.getInstance(mContext).getImageLoader();
String URL = products.get(position).getProductImageUrl();
holder.progressBar.setVisibility(View.VISIBLE); …Run Code Online (Sandbox Code Playgroud)