当前位置:网站首页>Custom recycleview delete & move animation
Custom recycleview delete & move animation
2022-07-27 21:27:00 【Azadoo】
First RecycleView There is a default animation 、 And the corresponding execution time
But in project development , Encountered a need to delete item Adjust the dynamic effect of
Ideas 1. Can be in holder in ( For example, click to delete ) Directly for the present view Set custom animation and execute
Ideas 2. rewrite recycleView Default animation SimpleItemAnimator
Thinking in simple scenes 1 It can achieve the expected effect , But I have another problem in the project ,ui The given animation needs to be deleted at the same time The list below should be moved up at the same time .
however recycleView The default is to delete the animation and then execute the mobile animation Thinking in this case 1 Can't meet expectations Can only override SimpleItemAnimator 了
The good news is recycleView It has encapsulated a default DefaultItemAnimator Abstract classes in this class SimpleItemAnimator All methods are implemented by rewriting We just have to inherit DefaultItemAnimator Rewrite the method that needs to be adjusted
The bad news is There is no internal method that can directly call to start moving animation or delete animation There are plenty of them runPendingAnimations() The method internally sets the actual execution of each animation We rewrite this method Almost equivalent to the need to rewrite the entire class
Source code is as follows
@Override
public void runPendingAnimations() {
boolean removalsPending = !mPendingRemovals.isEmpty();
boolean movesPending = !mPendingMoves.isEmpty();
boolean changesPending = !mPendingChanges.isEmpty();
boolean additionsPending = !mPendingAdditions.isEmpty();
// Determine whether there is animation to be executed
if (!removal边栏推荐
- Qmodbus library is used, and it is written as ROS node publishing topic and program cmakelist
- Understanding network model overview of network model
- Comprehensively design an oppe home page -- the style of the search and oper part of the page
- 一文读懂Plato Farm的ePLATO,以及其高溢价缘由
- ADB shell LS /system/bin (index table)
- ADB ~ 隐藏或禁用状态栏和虚拟按键
- The use experience of the product is up to you in the evaluation and exchange meeting of the flying oar frame experience!
- 论文赏析[EMNLP18]用序列标注来进行成分句法分析
- Good driving, inexpensive, comfortable and safe! Experience BYD song Pro DM-I in depth
- 大佬们,mysql版本低,不支持cdc,所以canal同步binlog至kafka,数据同步至cli
猜你喜欢

IOU target tracking II: viou tracker

ZABBIX monitoring service (III) configuration management graphics and windows

PG free space map & visibility map

Conquer 3 pieces of IT equipment for all programmers →

What are the product performances of industrial Ethernet switches?

新来CTO 强烈禁止使用Calendar...,那用啥?

Win11 user name and password backup method

Chinese and English instructions - abfluor 488 cell apoptosis detection kit

Worthington phospholipase A2 study phosphatidylcholine 2-acetylhydrolase

The new CTO strongly prohibits the use of calendar?
随机推荐
Principle analysis and best practice of guava cache
激光雷达中国前装大幕开启,数百万颗产能待消化
The use experience of the product is up to you in the evaluation and exchange meeting of the flying oar frame experience!
ADB ~ 隐藏或禁用状态栏和虚拟按键
基于DSP 回传音通话降噪链路设计
数字化工厂系统有什么现实优势
Knife4j dynamically refreshes global parameters through JS
R language uses t The test function performs a t-test to verify whether the population mean is a specific value (inferring the population mean from the sample set)
Acwing3715. Minimum exchange times (simulation idea of bubble sorting method)
Understanding Network Model OSI model
Win11 user name and password backup method
工程技术开发的圈套与局限性
飞桨框架体验评测交流会,产品的使用体验由你来决定!
Plato Farm在Elephant Swap上铸造的ePLATO是什么?为何具备高溢价?
Custom learning rate
Puzzle (021) eliminate problems
常见ArrayLIst面试题
【华为HCIE安全考什么科目?华为HCIE安全考什么知识点?】
Traps and limitations of Engineering Technology Development
[2022 Niuke multi School Game 2] k-link with bracket sequence I