How to build a horizontal ListView with RecyclerView

I need to implement a horizontal listview in my Android application. I did a bit of research and came across How can I make a horizontal ListView in Android? and Horizontal ListView in Android?. However, these questions were asked before Recyclerview was released. Is there a better way to implement this now with Recyclerview? 15 … Read more

How to create RecyclerView with multiple view types

From Create dynamic lists with RecyclerView: When we create a RecyclerView.Adapter we have to specify ViewHolder that will bind with the adapter. public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { private String[] mDataset; public MyAdapter(String[] myDataset) { mDataset = myDataset; } public static class ViewHolder extends RecyclerView.ViewHolder { public TextView mTextView; public ViewHolder(TextView v) { super(v); mTextView … Read more

Why doesn’t RecyclerView have onItemClickListener()?

I was exploring RecyclerView and I was surprised to see that RecyclerView does not have onItemClickListener(). I’ve two question. Main Question I want to know why Google removed onItemClickListener()? Is there a performance issue or something else? Secondary Question I solved my problem by writing onClick in my RecyclerView.Adapter: public static class ViewHolder extends RecyclerView.ViewHolder … Read more

How to add dividers and spaces between items in RecyclerView

This is an example of how it could have been done previously in the ListView class, using the divider and dividerHeight parameters: <ListView android:id=”@+id/activity_home_list_view” android:layout_width=”match_parent” android:layout_height=”match_parent” android:divider=”@android:color/transparent” android:dividerHeight=”8dp”/> However, I don’t see such possibility in the RecyclerView class. <android.support.v7.widget.RecyclerView android:id=”@+id/activity_home_recycler_view” android:layout_width=”match_parent” android:layout_height=”match_parent” android:scrollbars=”vertical”/> In that case, is it ok to define margins and/or add a … Read more