android-recyclerview

when does getItemCount() method get called in RecycleView adapter?

一世执手 提交于 2020-01-10 18:45:12
问题 I have a adapter which populates data to RecyclerView . I am not calling notifyDataSetChanged() and I am setting the adapter to the RecyclerView in onCreateView() (so in getItemCount() should be called once) in Fragment but I find getItemCount() called multiple times. 来源: https://stackoverflow.com/questions/31748131/when-does-getitemcount-method-get-called-in-recycleview-adapter

when does getItemCount() method get called in RecycleView adapter?

▼魔方 西西 提交于 2020-01-10 18:44:11
问题 I have a adapter which populates data to RecyclerView . I am not calling notifyDataSetChanged() and I am setting the adapter to the RecyclerView in onCreateView() (so in getItemCount() should be called once) in Fragment but I find getItemCount() called multiple times. 来源: https://stackoverflow.com/questions/31748131/when-does-getitemcount-method-get-called-in-recycleview-adapter

ScrollView vs RecyclerView for dissimilar children on Android

风格不统一 提交于 2020-01-10 14:08:07
问题 I have a mix of 10-15 custom views and fragments to be shown in a vertical list. I am not sure if RecyclerView has any advantage in scenarios where all views are dissimilar. RecyclerView seems to add lot of boiler-plate code, and I think the only advantage I would get is easier enter/exit animation. My custom views/fragment also make web-service call on being created. We don't cache web-requests for business reasons. My understanding is that RecyclerView would trigger these web-service calls

RecyclerView.getChild(index) shows null when list is scrolled (index gets messed up)

谁都会走 提交于 2020-01-10 13:30:31
问题 I've been using SwipeableRecyclerView for my android application for enabling swipes for my recyclerView. RecyclerView contains a list of cardViews. I was trying to implement undo functionality for cards which will get deleted when swipe to left (first swipe shows undo, next swipe triggers delete) I am trying the following code (partially working I guess) SwipeableRecyclerViewTouchListener srvTouchListner = new SwipeableRecyclerViewTouchListener(rvTimerList, new

How to get the position of cardView item in recyclerView?

我的未来我决定 提交于 2020-01-10 09:21:29
问题 I created one adapter class for recycler for populating cardview layout in recyclerview. It is working fine, but when i click cardView item in recyclerview i need to get position of that cardview item , based on that i need to write a Intent activity. Along with how to delete that cardview item when i swipe left to right. MyAdapter class. public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { private NavigationItem[] navigationItem; private Context mContext; public

How to get the position of cardView item in recyclerView?

荒凉一梦 提交于 2020-01-10 09:21:28
问题 I created one adapter class for recycler for populating cardview layout in recyclerview. It is working fine, but when i click cardView item in recyclerview i need to get position of that cardview item , based on that i need to write a Intent activity. Along with how to delete that cardview item when i swipe left to right. MyAdapter class. public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { private NavigationItem[] navigationItem; private Context mContext; public

Android prevent nested recyclerview from automatically repositioning [duplicate]

北城余情 提交于 2020-01-10 03:48:05
问题 This question already has answers here : How to remove focus from RecyclerView inside ScrollView? (5 answers) Closed 5 months ago . I have a ViewPager as an item in a Linear Layout, with each item in the view pager containing a RecyclerView. The problem is, whenever the page initially loads, or when I change pages on the ViewPager, the view automatically scrolls so the beginning of the recycler view is the top of the screen, rather than staying how it is. A .gif of the issue is here. Note I

Lazy Loading recyclerView in android

谁说胖子不能爱 提交于 2020-01-09 19:32:47
问题 Does anyone know how to implement Lazy Loading recyclerView in android?I'm pretty new to android and I don't know how to figure this out.I'll be thankful if anyone helps. 回答1: You may use EndlessRecyclerView Overview A common application feature is to load automatically more items as the user scrolls through the items (aka infinite scroll). This is done by triggering a request for more data once the user crosses a threshold of remaining items before they've hit the end. The approaches for

RecyclerView does not Recycling Views when use it inside NestedScrollView

主宰稳场 提交于 2020-01-09 12:42:07
问题 I'm using RecyclerView inside NestedScrollView . Also i set setNestedScrollingEnabled to false for recyclerview to support lower API ViewCompat.setNestedScrollingEnabled(mRecyclerView, false); Now! When user scrolled the view every thing seems okay, but!!! views in recyclerview does not recycled!!! and Heap size grows swiftly!! Update : RecyclerView layout manager is StaggeredLayoutManager fragment_profile.xml : <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas

How to add a button at the end of RecyclerView?

…衆ロ難τιáo~ 提交于 2020-01-09 12:17:49
问题 I want to show a button at the end of RecyclerView. With ListView there was a method addFooterView(), how to do the same with RecylerView. 回答1: One way to do it would be to make your footer view a "ViewType" of your adapter. In order to do that, overrides getItemViewType to return a different value for your last item. @Override public int getItemViewType(int position) { return (position == mData.size()) ? VIEW_TYPE_FOOTER : VIEW_TYPE_CELL; } Then in the onCreateViewHolder, handle the