Tag: recyclerview

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

scrollBy doesn't work properly in nested recyclerview

I have a vertically scrolling RecyclerView with horizontally scrolling inner RecyclerViews just like this. With this implementation, users can scroll each horizontal recyclerview synchronously. However, when a user scroll vertically to the parent recyclerView, a new horizontal recyclerview which has just attached on window doesn’t display on same scroll x position. This is normal. Because […]

Floating action button not displaying over recyclerview(which is inside a DrawerLayout)

I am trying to get FAB over recyclerview which in my case will cover the whole screen. The FAB wont display even recyclerview is empty. Following is my xml code. <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/drawer_layout” xmlns:tools=”http://schemas.android.com/tools” xmlns:app=”http://schemas.android.com/apk/res-auto” tools:context=”com.technistan.ledger.CreateLedger” android:layout_width=”match_parent” android:layout_height=”match_parent”> <LinearLayout android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent”> <include android:id=”@+id/tool_bar” layout=”@layout/tool_bar” ></include> <FrameLayout android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.v7.widget.RecyclerView android:paddingLeft=”2dp” android:paddingRight=”2dp” android:id=”@+id/recyclerView” android:layout_width=”wrap_content” […]

How can RecyclerView ItemTouchHelper lock swipe item?

I use RecyclerView with ItemTouchHelper to do swiping to remove, and add delete button under the swipe item like this: But when I finish swiping, the item will be removed from the list soon! How can I lock the swiped item, and removed by clicking the delete button? Just like Gmail’s behavior. ps. I post […]

Get width of CardView in Adapter.onBindViewHolder

I have a list of posts and most of them are pictures (simply put it is posts just like G+ or FB apps). Each post entry has an image aspect ratio, so I can set image height based on it’s width even before image was loaded from server, so card layout wouldn’t change on load. […]

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