Tag: recyclerview

How to implement multi-select in RecyclerView?

ListView had a multiple choice mode, what should I use for implementing the same using RecyclerView? How to handle onItemCheckedStateChanged? I checked this, But i couldn’t make out much out of this. Any code snippet or a sample project implementing the same would be great. Thanks in advance.

“LayoutManager is already attached to a RecyclerView” error

I am trying to have multiple RecyclerViews in a layout but I get the following error: “LayoutManager is already attached to a RecyclerView” The Java code is: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_squad, container, false); Activity parentActivity = getActivity(); final […]

android recyclerview doesn't display items

I want to show these items inside my recyclerview but it doesn’t show at all and I can’t see the error. Maybe you guys can help me out. MainActivity.java RecyclerView recyclerView = (RecyclerView)findViewById(R.id.rec); List<MenuData> list = new ArrayList<>(); recyclerView.setHasFixedSize(true); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(linearLayoutManager); MenuRecAdapter menuRecAdapter = new MenuRecAdapter(list); recyclerView.setAdapter(menuRecAdapter); RecyclerView adapter: public […]

RecyclerView scrolling on insert

I am trying to use RecyclerView to create a chat application. I am using a LinearLayoutManager with setReverseLayout(true). When I am scrolled all the way to the bottom (which is the dataset start = newest message) and a new message is inserted into the dataset, the item appears at the bottom of the list as […]

Spacing Issue while creating bus layout in recycler view Gridlayout manager

I’m using recycler view with GirdLayout Manager for creating bus layout my problem is with spacing I’m populating data according to row column This is how I’m getting layout This is how i want my layout to be: i want the item at row 3 and column 2 beside sleeper seat at row 2 column […]

How to implement slide to show actions in recyclerview?

I have an app with a recyclerview showing some elements, the recyclerview also supports multiple viewtypes that can be changed from the settings. I am now looking to implement a way to show some actions for the recyclerview-items when a user swipes the item. Specifically I was looking for a way to implement a pane […]

StaggeredGridLayoutManager reorders items

My items has different layouts and sometimes I create a gap or gaps on top of RecyclerView by dragging items in layout. When I scroll back to the top of RecyclerView some items are reordered and gaps get filled by them. Behavior is captured here: Filling gaps is okay. It is also okay when items […]

Showing custom View under swiped RecyclerView item

First of all, I saw this question: Adding a colored background with text/icon under swiped row when using Android's RecyclerView However, even though the title states “with text/icon”, the answer only covers using Canvas object to draw a rectangle. Now I have drawing a green rectangle implemented; however I want to make it more obvious […]

Are there any Observers written In RecyclerView.Adapter to know if dataset has been changed?

I have implemented my RecyclerView with it’s Custom Adapter as follows Global Declarations as follows private LinearLayoutManager linearLayoutManager; private int pastVisibleItems, visibleItemCount, totalItemCount; private CustomRecyclerViewAdapter customRecyclerViewAdapter; First I created Adapter Instance inside onCreate() method which has Empty Array inside it and set it to recyclerView linearLayoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(linearLayoutManager); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration( […]

Drag View and Drop it on RecyclerView item Android

I am developing an android application that has a screen contains the following: Recycler view that contains categories as the below figure Separate view at the botton and the user should able to drag it on a RecyclerView item, and after drop the user will show changing at the RecyclerView item data (for example items […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.