android-recyclerview

How do I detect OverScroll in android RecyclerView?

无人久伴 提交于 2021-02-07 20:20:17
问题 I have tried to overwrite onOverScrolled() but it is not triggered: public class MyRecyclerView extends RecyclerView { public MyRecyclerView(@NonNull Context context) { super(context); } public MyRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public MyRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onOverScrolled(int scrollX, int scrollY, boolean

How do I update recyclerView inside onBindViewHolder of its adapter?

孤者浪人 提交于 2021-02-07 19:37:20
问题 I've made a list of cards inside recyclerView. When card is held for sometime, its corresponding entry in database is deleted so after that, the card must be removed. It can be done by calling setting new updated adapter. But I'm unable to use setAdapter function inside onBindViewHolder because I don't know how to get same recyclerView. Please help. CODE: public class RecyclerViewAdapterMain extends RecyclerView.Adapter<RecyclerViewAdapterMain.ViewHolder> { String[] strings; DBManager

Android only setStackFromEnd only if RecycleView/List is larger than screen

送分小仙女□ 提交于 2021-02-07 19:16:56
问题 I have a RecyclerView that I want to start showing the bottom items, so I'm using: myLayoutManager.setStackFromEnd(true) . It works just as I want when there are enough items to fill the screen, but if there are only a few items in the RecyclerView, it pushes them down and leaves empty space at the top of the screen Is there any way prevent this, or to only setStackFromEnd if the RecyclerView is larger than the screen height? Here's an example of what I get and what I'm trying to get: 回答1:

Android only setStackFromEnd only if RecycleView/List is larger than screen

不羁的心 提交于 2021-02-07 19:16:05
问题 I have a RecyclerView that I want to start showing the bottom items, so I'm using: myLayoutManager.setStackFromEnd(true) . It works just as I want when there are enough items to fill the screen, but if there are only a few items in the RecyclerView, it pushes them down and leaves empty space at the top of the screen Is there any way prevent this, or to only setStackFromEnd if the RecyclerView is larger than the screen height? Here's an example of what I get and what I'm trying to get: 回答1:

What is the best way to do sliding images in cardview inside recycler?

假装没事ソ 提交于 2021-02-07 11:55:14
问题 I have a RecyclerView with Cardview s. I want sliding images inside this CardView, just like in OLX app. What is the best way to do so? I think about puting viewpager inside cardview. Is it ok or maybe I should try something else? I did it with ViewPager but it looks like too slow. Here is a part of viewpager adapter. @Override public Object instantiateItem(ViewGroup collection, int position) { LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup layout = (ViewGroup) inflater

How to disable scrolling of RecyclerView except programmatically

不羁岁月 提交于 2021-02-07 11:13:56
问题 I have a RecyclerView with a LinearLayoutManager in orientation HORIZONTAL . Each item in it can have interactive elements (including vertical ScrollView s). Is there a way to easily make the RecyclerView ignore any attempts by the user to scroll or fling the RecyclerView horizontally without intercepting touch events to the children? I am programmatically controlling the scroll of the RecyclerView which works great until the user flings it. I have tried something very simple where the idea

Swipe card to favourite item

こ雲淡風輕ζ 提交于 2021-02-07 10:57:42
问题 I was viewing the Material docs from Google when I stumbled upon this video. It shows a card item which can be swiped to the right to favourite an item. I want to mirror this behaviour but have failed multiple times. All libraries and tutorials I can find are about swipe-to-delete . I tried to have two views stacked upon each other where the one on top should be swiped so the one below would become visible. I tried to achieve this with the ItemTouchHelper , but this class seems to only be

How do I handle Firebase Adapter RecyclerView empty view?

痞子三分冷 提交于 2021-02-07 10:23:21
问题 So the issue is that whenever I set my empty view for the recycler view, it always shows the empty view. I tried following some suggested solutions like the one in this url: FirebaseRecyclerAdapter with empty view, but the problem is that Firebase listeners are asynchronous and runs on its own thread. Before even setting the empty view, the fragment's onCreateView method already returns the view and so the empty view is not set appropriately. Are there any other way to implement the setting

How do I handle Firebase Adapter RecyclerView empty view?

旧巷老猫 提交于 2021-02-07 10:22:32
问题 So the issue is that whenever I set my empty view for the recycler view, it always shows the empty view. I tried following some suggested solutions like the one in this url: FirebaseRecyclerAdapter with empty view, but the problem is that Firebase listeners are asynchronous and runs on its own thread. Before even setting the empty view, the fragment's onCreateView method already returns the view and so the empty view is not set appropriately. Are there any other way to implement the setting

TextView won't display after removing all recyclerview items

独自空忆成欢 提交于 2021-02-07 10:12:41
问题 I've implemented two RecyclerView adapters, one is RecyclerViewAdapter and the other one is EmptyRecyclerViewAdapter. What I'm trying to do is to display the text Empty Text Here! whenever all the items are removed. Image 2 is working if there are no items yet in the list and it will display the text Empty Text Here! which is shown on Image 2 below however, If there are already items on the list and If i will remove all of the items in the list, Image 1 will be the result which displays