android-recyclerview

Lags when RecyclerView scrolling

最后都变了- 提交于 2019-12-10 06:26:28
问题 I can not understand what is the reason the brakes when you scroll through my RecyclerView. Scrolling is called by mRecyclerView.smoothScrollToPosition(position); When you scroll through the list of twitches (rendering time frame> 16ms) AlphaAdapter.java public class AlphaAdapter extends RecyclerView.Adapter<AlphaAdapter.ViewHolder> { private static final String TAG = "AlphaAdapter"; private Context mContext; private List<PrimaryWeapon> mGunList; private boolean isAnimate; private final int

Animate Recycler View grid when number of columns change

佐手、 提交于 2019-12-10 03:54:24
问题 I am using a RecyclerView with GridLayoutManager . Users can toggle the span count between 2 and 4, which would result in an animation that runs the inbuilt translate animation for each cell to it's new position. Code I have been using thus far is: TransitionManager.beginDelayedTransition(moviesGridRecycler); gridLayoutManager.setSpanCount(NEW_SPAN_COUNT); adapter.notifyDataSetChanged(); This has been working fine for me, but now I need to have a different layout for each span count. To

Measure Recyclerview before it appears

前提是你 提交于 2019-12-10 03:52:29
问题 I am currently experiencing an issue when measuring a recyclerView before it appears. I need the measuredHeight in order to start an "expand" animation. This was previously done for a gridView in the code I'm working on and I am trying to migrate it to a RecyclerView with GridLayoutManager final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); final int heightSpec = View.MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, View.MeasureSpec.AT_MOST); mGridView

RecyclerView calling onCreateViewHolder and onBindViewHolder for all items at once

旧街凉风 提交于 2019-12-10 03:28:43
问题 I have a recyclerView capable of showing the maximum of 3 items on screen, but it calls onCreateViewHolder and onBindViewHolder for all 45 items in the list, all at once (as in the LOG below). Shouldn't it be calling those methods only as I scroll those items to the screen? *I am using a list with 0's and 1's as a test to define which layout it should use. My Adapter Code public class MyRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { int[] post_list; private static

Infinite animation in RecyclerView stops after scrolling

ⅰ亾dé卋堺 提交于 2019-12-10 03:17:07
问题 I have multityped RecyclerView with animated views(blinking white circles) inside items. During recyclerView scrolling animations can randomly stop working. I thought this problem is connected with onCreateViewHolder or onBindViewHolder , but this issue reproducing even if none of this methods were called. Animation repeat count set to infinite, clearAnimation() only called in onBindViewHolder . My adapter code : import android.content.Context; import android.content.Intent; import android

How to put RecyclerView below CollapsingToolbarLayout and responsive to toolbar when collapsed in Android?

◇◆丶佛笑我妖孽 提交于 2019-12-10 03:09:04
问题 I am developing an Android App. In my app I am using, CollapsingtoolbarLayout together with RecyclerView. Both are working. But I am having a problem with positioning them. What I want is I want RecyclerView directly below Collapsing Toobar and I want RecyclerView go up together with toolbar when it is collapsed. But my code is not working as I expected. This is what happening now. As you can see recycler view is having fixed position covered with toolbar. It is not responsive to collapsed

Detecting onClick in recycler view using data binding in android

为君一笑 提交于 2019-12-10 02:48:58
问题 I am Referring to vogella-tutorial for databinding What i am trying to do : What is the best way to detect onClick in recycler view row for each Item using the dataBinding activity_second.xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> <variable name="temp" type="com.vogella.android.databinding.TemperatureData" /> <variable name="presenter" type="com.vogella.android.databinding.MainActivityPresenter"/> </data> <android

Disable ViewPager paging when child recyclerview scrolls to last item

别说谁变了你拦得住时间么 提交于 2019-12-10 02:34:56
问题 I have a viewpager and within one of the fragments I have two separate fragments containing a vertical and a horizontal recyclerview respectively. When I scroll the horizontal recyclerview to the last item and try to swipe further, the viewpager scrolls to the next page. I do not want this to happen. I want to disable the viewpager's paging when I try to overscroll the horizontal recyclerview. However, I do not want to disable the viewpager's paging when I swipe anywhere else. For example, If

How to make RecyclerView's grid item to have equal height and width?

谁都会走 提交于 2019-12-10 02:19:24
问题 I define my RecyclerView as grid by setting its layout with GridLayoutManger that has a span count of 3 which are already working fine. I also add an item decorator to my recycler view which will manage the spacing between grid items, this also works fine. public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration { private int spanCount; private int spacing; private boolean includeEdge; public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) { this

Tracking what all items of a list are currently visible on the screen

大城市里の小女人 提交于 2019-12-09 23:55:46
问题 Suppose I have a recyclerview with 10 items. Out of these 10, 0 - 4 are visible in one go. On scrolling down, 0th element goes away from the screen and 5th one enters. I want to track these events - where I get to know that elements 0 - 4 are visible and then on scrolling, 1-5 are. Is there anyway to achieve this? I want to keep track of how long a user is spending time on a particular items of the recyclerview. 回答1: set addOnScrollListener on RecyclerView and get first and last visible rows