android-recyclerview

Properly overwriting RecyclerView animations

前提是你 提交于 2020-12-31 04:47:39
问题 I have a RecycleView in which a display a list of items. I specify the default animator to the RecyclerView like this: recyclerView.setItemAnimator( new DefaultItemAnimator() ); Everything works great, but I want to use my own custom animations for adding/removing/updating the elements in the list. I defined a custom animator class like this: public class MyAnimator extends RecyclerView.ItemAnimator { @Override public boolean animateDisappearance(@NonNull RecyclerView.ViewHolder viewHolder,

Properly overwriting RecyclerView animations

痞子三分冷 提交于 2020-12-31 04:46:42
问题 I have a RecycleView in which a display a list of items. I specify the default animator to the RecyclerView like this: recyclerView.setItemAnimator( new DefaultItemAnimator() ); Everything works great, but I want to use my own custom animations for adding/removing/updating the elements in the list. I defined a custom animator class like this: public class MyAnimator extends RecyclerView.ItemAnimator { @Override public boolean animateDisappearance(@NonNull RecyclerView.ViewHolder viewHolder,

Properly overwriting RecyclerView animations

谁说胖子不能爱 提交于 2020-12-31 04:46:30
问题 I have a RecycleView in which a display a list of items. I specify the default animator to the RecyclerView like this: recyclerView.setItemAnimator( new DefaultItemAnimator() ); Everything works great, but I want to use my own custom animations for adding/removing/updating the elements in the list. I defined a custom animator class like this: public class MyAnimator extends RecyclerView.ItemAnimator { @Override public boolean animateDisappearance(@NonNull RecyclerView.ViewHolder viewHolder,

RecyclerView changes its scroll position when inside a ConstraintLayout

做~自己de王妃 提交于 2020-12-30 07:43:44
问题 I encountered an issue with RecyclerView when it is a child of a ConstraintLayout . Originally, the RecyclerView was somewhere deep in the view hierarchy of Relative- , Frame- and LinearLeayout s, and everything worked well until I decided to flatten view tree using ConstraintLayout. I noticed that each time when there is a layout change, caused by anything (window resize, data set change notification, etc), the scroll position of the RecyclerView is changed. For example, every time I show

RecyclerView in SwipeRefreshLayout not “wrap_content”

五迷三道 提交于 2020-12-30 06:25:27
问题 I have a RecyclerView as the only child of SwipeRefreshLayout , I want the RecyclerView wrap_content . When I set both of them "wrap_content", it doesn't work. The RecyclerView with fewer items also match_parent . When i delete SwipeRefreshLayout , the RecyclerView will wrap_content . Can anyone help me? My English is poor, Maybe you cann't understand. Anyone can help me? Thank you very much. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk

RecyclerView in SwipeRefreshLayout not “wrap_content”

假如想象 提交于 2020-12-30 06:24:16
问题 I have a RecyclerView as the only child of SwipeRefreshLayout , I want the RecyclerView wrap_content . When I set both of them "wrap_content", it doesn't work. The RecyclerView with fewer items also match_parent . When i delete SwipeRefreshLayout , the RecyclerView will wrap_content . Can anyone help me? My English is poor, Maybe you cann't understand. Anyone can help me? Thank you very much. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk

How to swipe one row of RecyclerView programatically (at run time)?

半城伤御伤魂 提交于 2020-12-29 13:22:52
问题 I have a RecyclerView with items inside like this: I use ItemTouchHelper.SimpleCallback to listen for swipe and onChildDraw() to draw a canvas when items are swiped: A bit more swipe: My problem: I want to simulate a swipe (at run time) just on first item inside the list of items; I need first item to go (more or less ) -100 px on its X axis and then go back to original position. How to achieve this? 回答1: I created some utility method in case someone needs it import android.animation

Changing layout managers for different views in RecyclerView

佐手、 提交于 2020-12-28 20:51:03
问题 I implemented an expandable recyclerview with child elements that are part of the list. I followed this code. This is how it works, The implementation of ExpandableListView using RecyclerView is briefly described as follows. The list model has an additional parameter "type" that identifies whether the item is a header or child. By checking this parameter, the adapter inflates view and viewholder corresponding to the type. If the type is HEADER, it will inflate the layout of header item, that

Changing layout managers for different views in RecyclerView

左心房为你撑大大i 提交于 2020-12-28 20:46:06
问题 I implemented an expandable recyclerview with child elements that are part of the list. I followed this code. This is how it works, The implementation of ExpandableListView using RecyclerView is briefly described as follows. The list model has an additional parameter "type" that identifies whether the item is a header or child. By checking this parameter, the adapter inflates view and viewholder corresponding to the type. If the type is HEADER, it will inflate the layout of header item, that

Override animation for notifyItemChanged in RecyclerView.Adapter

被刻印的时光 ゝ 提交于 2020-12-27 07:51:19
问题 Well, I have a RecyclerView with an adapter and everything works great. The items in the ArrayList dataset are being updated periodically. So the items and their elements as well as their position in the list change. This is achieved by simple sorting and manually calling these methods, whenever things happen: // swapping two items Collections.swap(items, i, j); itemsAdapter.notifyItemMoved(i, j); // adding a new one itemAdapter.notifyItemInserted(items.size()); // when updating valus