Tag: recyclerview

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

Not working Notifydatasetchange on RecyclerView with center selection Horizontal Scrollview?

Auto Scrolling is issue & also move to some specific position using code is difficult. I am making two recyclerView dependent to each other with the Horizontal Scroll and center selection. So my problem is using the method of Notifydatasetchanged and reseting recyclerView postion to 0 and it’s scrolling selection range because it’s returning wrong […]

Streaming video list using Exoplayer

I’d like to implement streaming video list app. I used a RecyclerView to display my list item. Item type includes 4 type: Article, Status, Photo and Video. We should only focus on Video type. Here is my code for RecyclerView’s adapter: public class FollowedPostAdapter extends RecyclerView.Adapter implements OnFollowTagCallback, OnLikeCallback { private Context context; private List<PostItem> […]

removing cursor based items in RecyclerView

This is how my recyclerView is coded (partially): expensesListCursor = dbc.listExpenses(selectedDate); mLayoutManager = new LinearLayoutManager(getActivity()); rvExpenses.setLayoutManager(mLayoutManager); rvExpenses.setItemAnimator(new DefaultItemAnimator()); mAdapter = new AdapterExpensesList(expensesListCursor,getActivity()); rvExpenses.setAdapter(mAdapter); here’s how my dbc.ListExpenses is written public Cursor listExpenses(String date){ Cursor cursor; cursor = database.query(MySQLiteHelper.TABLE_EXPENSES, new String[] {“rowid as _id”, “description, cost”}, “date='” + date + “‘”, null, null, null, “_id asc”); […]

Stop items from moving around when using StaggeredGridLayoutManager

I’m using recyclerview with staggredGridLayoutManager in android. The problem is, sometimes when scrolling items move around to fit in the screen. Normally it’s nothing to worry about but in my case it messes up everything! So is there anyway to stop this behavior? Not just the animation. The whole items rearranging stuff. thank you

RecyclerView scrolls to top on notifyDataSetChanged in chat screen

I am trying to create messaging kind of screen using recyclerView which will start from bottom and will loadMore data when user reached top end of chat. But I am facing this weird issue. My recyclerView scrolls to top on calling notifyDataSetChanged. Due to this onLoadMore gets called multiple times. Here is my code: LinearLayoutManager […]

Android selectableItemBackground no glow effect on long press

I am trying to use the RecyclerView in an Android app. I imported the RecyclerView sample project into Android Studio, and it works fine. I want to make the items in the recycler view to react visually when the user long presses them. In order to do that, I set the background of the view […]

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