When I used the new recycler view, I noticed that the scrollbar is not as fluid as in a regular ScrollView / ListView. It doesn't seem like it recognizes when you scroll the adapter element, but it only changes when a new element / old element appears, so the progress indicator jumps, rather than moving smoothly. This video demonstrates this problem. Is there any way to make it smooth?
My layout:
<android.support.v7.widget.RecyclerView android:id="@+id/listRecycler" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent"/>
Fragment:
mListRecycler.setAdapter(mAdapter); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); mListRecycler.setLayoutManager(layoutManager);
Adapter:
public class NewsAdapter extends RecyclerView.Adapter<NewsAdapter.ViewHolder> { private List<News> items; private int itemLayout; public NewsAdapter(List<News> items, int itemLayout) { this.items = items; this.itemLayout = itemLayout; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(itemLayout, parent, false); v.setOnClickListener(this); return new ViewHolder(v); } @Override public void onBindViewHolder(ViewHolder holder, int position) { News item = items.get(position); holder.text.setText(item.getTitle()); holder.itemView.setTag(item); } @Override public int getItemCount() { return items.size(); } public static class ViewHolder extends RecyclerView.ViewHolder { @InjectView(R.id.title) TextView text; public ViewHolder(View itemView) { super(itemView); ButterKnife.inject(this, itemView); } }
}
source share