Recyclerview inside ScrollView not scrolling smoothly

For my app I am using a RecyclerView inside a ScrollView where the RecyclerView has a height based on its content using this library. Scrolling is working but it’s not working smoothly when I scroll over the RecyclerView. When I scroll over the ScrollView itself it is scrolling smoothly. The code I am using to … Read more

Recyclerview not call onCreateViewHolder

My RecyclerView does not call onCreateViewHolder, onBindViewHolder even MenuViewHolder constructor, therefore nothing appears in RecyclerView. I put logs for debugging, and no log is shown. What might be the problem? My adapter: public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.MenuViewHolder> { private LayoutInflater inflater; List<Menu> data = Collections.emptyList(); public MenuAdapter(Context context, List<Menu> data) { Log.i(“DEBUG”, “Constructor”); inflater = … Read more

How do I make WRAP_CONTENT work on a RecyclerView

I have a DialogFragment that contains a RecyclerView (a list of cards). Within this RecyclerView are one or more CardViews that can have any height. I want to give this DialogFragment the correct height based on the CardViews that are contained within. Normally this would be simple, I would set wrap_content on the RecyclerView like … Read more

Should we use RecyclerView to replace ListView? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 1 year ago. Improve this question Android Docs say: The RecyclerView widget is a more advanced and flexible version of ListView. This … Read more

How to use RecyclerView inside NestedScrollView?

How to use RecyclerView inside NestedScrollView? RecyclerView content is not visible after setting adapter. UPDATE layout code updated. <android.support.v4.widget.NestedScrollView xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <RelativeLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:padding=”@dimen/keyline_1″> </RelativeLayout> <View android:id=”@+id/separator” android:layout_width=”match_parent” android:layout_height=”1dp” android:background=”#e5e5e5″ /> <android.support.v7.widget.RecyclerView android:id=”@+id/conversation” android:layout_width=”match_parent” android:layout_height=”wrap_content” /> </LinearLayout> </android.support.v4.widget.NestedScrollView> 26 Answers 26

How can a divider line be added in an Android RecyclerView?

I am developing an android application where I am using RecyclerView. I need to add a divider in RecyclerView. I tried to add – recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST)); below is my xml code – <android.support.v7.widget.RecyclerView android:id=”@+id/drawerList” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginTop=”15dp” /> 24 Answers 24

Scroll RecyclerView to show selected item on top

I’m looking for a way to scroll a RecyclerView to show the selected item on top. In a ListView I was able to do that by using scrollTo(x,y) and getting the top of the element that need to be centered. Something like: @Override public void onItemClick(View v, int pos){ mylistView.scrollTo(0, v.getTop()); } The problem is … Read more

Simple Android grid example using RecyclerView with GridLayoutManager (like the old GridView)

I know that RecyclerView has replaced the functionality of the old ListView and GridView. I am looking for a very basic example that shows a minimal grid setup using RecyclerView. I am not looking for long tutorial style explanations, just a minimal example. I imagine the simplest grid that mimics the old GridView would consist … Read more