Tag: recyclerview

“RecyclerView: No Adapter attached; skipping layout” for recyclerview in fragment

This question already has an answer here: recyclerview No adapter attached; skipping layout 13 answers

Toolbar inside CardView to create a popup menu (overflow icon)

I have a list that looks like google play in a recyclerview with cardview, and works perfect. I need to add a popup menu (with overflow icon), like this: which is the best way to do this ? I researched and found that there are 2 options: 1 – with a toolbar inside the cardview […]

How to get touch feedback from RecyclerView?

I implemented a ReceylerView and I can’t figure out how to get touch feedback (the ripple effect from it). Here is what i did for the onClickListener: holder.itemView.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { //start Intent } }); And I added both clickable & focusable to my XML. This is what the recycler view […]

The simplest way to display Strings with icons in a RecyclerView

What is please the easiest way to show a list of Strings and icons in a RecyclerView? For ListView I use the following code (here a full project at GitHub) without a separate Adapter: mListView = (ListView) findViewById(R.id.list_view); mListView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mPlanets) { @Override public View getView(int position, View convertView, ViewGroup parent) { TextView view […]

I want my RecyclerView to not recycle some items

I’m using a RecyclerView with heterogeneous views inside, as seen in this tutorial. I have some items inside that RecyclerView that are RecyclerViews too. Too hard to imagine? Let’s say I want to copy the Play Store’s layout: One big RecyclerView with vertical linear layout and filled by many elements: Single apps and carousel of […]

How is the position of a RecyclerView adapter related to the index of its dataset?

I thought they were the same, but they’re not. The following code gives an indexOutOfBounds exception when I try to access the “position” index of my dataset, in this case a list of a model I created called Task: public class TaskAdapter extends RecyclerView.Adapter<TaskAdapter.TaskViewHolder> { private List<Task> taskList; private TaskAdapter thisAdapter = this; // cache […]

Android: RecyclerView item when set to clickable blocks onTouch events

Looks like setting RecyclerView’s item layout to clickable=”true”, consume some touch events completely, particulary MotionEvent.ACTION_DOWN (ACTION_MOVE and ACTION_UP afterwards are working): item.xml <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/demo_item_container” android:layout_width=”match_parent” android:layout_height=”?android:attr/listPreferredItemHeight” android:background=”?android:attr/selectableItemBackground” android:clickable=”true”> <– this what breaks touch event ACTION_DOWN …. </LinearLayout> Having very basic RecyclerView setup in onCreate(): RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list); … //Standard recyclerView init stuff […]

Nested Recyclerview scrolls by itself

I have a parent recyclerview that has 3 child view in it. The last two of the child are recyclerview. Parent recyclerview – child view 1 – child view 2 (horizontal rv) – child view 3 (horizontal rv) The issue is every time this fragment is visible, it scrolls itself to align with child view […]

How to recycleview adapter under another recycleview adapter?

I have a RecyclerView. It has a custom layout and inside the custom layout is another RecyclerView. When I notify the recycler view that an item has been deleted, my main recycler view is updated but my custom view recycle view is not getting notified. SwipeDismissRecyclerViewTouchListener listener = new SwipeDismissRecyclerViewTouchListener.Builder( recyclerView, new SwipeDismissRecyclerViewTouchListener.DismissCallbacks() { @Override […]

RecyclerView is cutting off the last item

I have a fragment with a toolbar and a recyclerView inside it. I am populating the recyclerView with dummy data and then try to show them. For some reason, the last element of the recyclerView is getting cut-off. This is the XML of the fragment: <?xml version=”1.0″ encoding=”utf-8″?> <android.support.design.widget.CoordinatorLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”@color/background_1″ android:fitsSystemWindows=”true”> […]

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