Tag: recyclerview

Android: how can I insert a RecyclerView inside CardView?

The activity I am talking about must show a RecyclerView populated by CardViews as items. My goal is to show in every CardView a RecyclerView in its turn. Here my Activity’s basic xml: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” tools:context=”.ConjActivity” > <android.support.v7.widget.RecyclerView android:id=”@+id/conjCardList” android:layout_width=”match_parent” android:layout_height=”match_parent” android:clickable=”false” /> </LinearLayout> And here is the layout […]

Why does OnClickListener on a ViewHolder don't work?

I’m trying to implement a way to handle item selection on a RecyclerView. I personally don’t like the way suggested in some answers on SO of passing through gestures, and I thought that implementing an OnClickListener, as suggested here and here, was waaay cleaner. The fact is that… this pattern doesn’t actually work! I’m really […]

OnLongItemClick in RecyclerView

I am starting to use RecyclerView in Android. Things work fine until I implement touch listener for my adapter. From this topic: https://stackoverflow.com/a/26826692/2923403 I can implement the listener for childview correctly. However, I would like to implement both OnItemClick and OnItemLongClick, then problem appear. They are always fired at the same time. OnItemClick first and […]

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 […]

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