android-recyclerview

android notifyItemRangeInserted disable autoscroll

心已入冬 提交于 2019-12-30 00:53:08
问题 I'm using RecyclerView as the base for my data list. i've implemented custom RecyclerView.Adapter which is based on ArraList. on fetching data from the internet the code that i'm running is: public void addItems(List<Item> items){ final int size = data.size(); data.addAll(items); notifyItemRangeInserted(size, items.size()); } Problem is that for after running this code i'm getting an autoscroll to the bottom of the list (last element is now visible) Is there a way to disable this? couldn't

RecyclerView that does not scroll and shows all items

安稳与你 提交于 2019-12-29 16:07:25
问题 I have a RecyclerView (and some other views) in a ScrollView. Currently the RecyclerView is laid out as very small (it shows 2 items out of 5 that it contains) and it scrolls independently of the ScrollView, which is obviously not great UX. I would like to get the RecyclerView to not scroll and to extend so that all its items are visible. (I know it's stupid to use a RecyclerView in this case. I'm only doing this because somewhere else in the app I need a normal RecyclerView with scrolling

RecyclerView - animate change of grid layout manager columns

最后都变了- 提交于 2019-12-29 13:32:18
问题 I want to animate the change of my RecyclerView s GridLayoutManager . I defaulty show a list of items in a grid with 3 columns and the user can select to show more or less columns. I would like the views in the RecyclerView to move/scale to their new positions, but I have no idea how this could be done. What I want in the end allow to scale the grid via an expand/contract touch gesture => I know how to do that animate the change of the LayoutManager Does anyone know how I can animate the

Is there any way to enable scrollbars for RecyclerView in code?

大兔子大兔子 提交于 2019-12-29 11:30:25
问题 As we saw, RecyclerView is more effective than ListView, so I prefer to use it in my project. But recently I have a trouble when put it in my custom ViewGroup. RecyclerView is easy to set scrollbars in xml like this: <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent" /> But I really can't find any method to set the scrollbars in code for RecyclerView, what I have tried

Android: Compilation error with v7 support lib 27.1.0 “Program type already present” android.support.v7.recyclerview.extensions.ListAdapter

喜夏-厌秋 提交于 2019-12-29 07:32:27
问题 I think there must be a bug with the 27.1.0 v7 support lib, just released. After updating my project to use it (from 26.1.0), I keep getting this compilation error: Task :app:transformDexArchiveWithDexMergerForRegularDebug FAILED D8 is used to merge dex. Program type already present: android.support.v7.recyclerview.extensions.ListAdapter FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:transformDexArchiveWithDexMergerForRegularDebug'. com.android.build

ListView to RecyclerView Migration for CustomView

允我心安 提交于 2019-12-29 07:21:29
问题 I see a need in my project to move from ListView to RecyclerView. I am facing some design issue. In my current ListView implementation I am using CustomView instead of inflating there. Here is my current getView() public View getView(int position, View containerRow, ViewGroup parent) { CustomView customView; if (containerRow == null) customView = new CustomView(mContext); else customView = (CustomView) containerRow; DataModel dataModel = getModelForPosition(position); if (dataModel != null) {

ListView to RecyclerView Migration for CustomView

核能气质少年 提交于 2019-12-29 07:21:12
问题 I see a need in my project to move from ListView to RecyclerView. I am facing some design issue. In my current ListView implementation I am using CustomView instead of inflating there. Here is my current getView() public View getView(int position, View containerRow, ViewGroup parent) { CustomView customView; if (containerRow == null) customView = new CustomView(mContext); else customView = (CustomView) containerRow; DataModel dataModel = getModelForPosition(position); if (dataModel != null) {

How to use fastScrollEnabled in RecyclerView?

空扰寡人 提交于 2019-12-29 06:38:09
问题 I am new to RecyclerView and I want to implement the fast scroll feature in RecyclerView like google contact application and search on the internet and i found that now Android provide officially New fastScrollEnabled boolean flag for RecyclerView. So my question is can someone provide the sample implementation of it. Here is the official document from google https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0 回答1: With Support Library 26, we can easily enable

Two ArrayList one RecyclerView Adapter

為{幸葍}努か 提交于 2019-12-29 06:31:15
问题 I have a chat screen where i can chat with other user, i am sending chat data (message,time and sender via List) to RecyclerAdapter which populate chat views with data.Now i have one more List which has data with different layout. Like this Here is my method from where i am calling second arraylist into RecyclerAdapter public void TransferResultTo_Activity(List<Image_data_Wrapper> list) { Log.d(TAG,"Here is data Result From AsyncTask "+list.size()); getResult=list; Image_data_Wrapper Image

Different (dynamic) items height in GridLayoutManager

99封情书 提交于 2019-12-29 06:13:08
问题 I have a RecyclerView and GridLayoutManager with 2 columns. How can I force LayoutManager to be according with template on the first screenshot? Now I have result as on the 2th screenshot. Need result: Current result: 回答1: GridLayoutManager will use a grid, and you can set some span, but not different heights for different cells. What you want is a StaggeredGridLayoutManager. This will just put the items on the screen if they fit, leading to your needed result. You can also change the