小编Gho*_*ost的帖子

动画RecyclerView无法正常工作

我试图用动画制作一个简单的例子RecyclerView,但默认动画不起作用.这是为什么?这里缺少什么?

主要活动:

public class MainActivity extends Activity {

List<Song> songsList;
RecyclerView recyclerView;
MyAdapter myAdapter;
RecyclerView.LayoutManager layoutManager;

Song song1;
Song song2;
Song song3;
Song song4;
Song song5;
Song song6;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    songsList = new ArrayList<>();

    song1 = new Song();
    song1.setName("Label1");
    song1.setAuthor("Author1");
    song1.setId(1);

    song2 = new Song();
    song2.setName("Label2");
    song2.setAuthor("Author2");
    song2.setId(2);

    song3 = new Song();
    song3.setName("Label3");
    song3.setAuthor("Author3");
    song3.setId(3);

    song4 = new Song();
    song4.setName("Label4");
    song4.setAuthor("Author4");
    song4.setId(4);

    song5 = new Song();
    song5.setName("Label5");
    song5.setAuthor("Author5");
    song5.setId(5);

    song6 = new Song();
    song6.setName("Label6"); …
Run Code Online (Sandbox Code Playgroud)

android android-animation android-recyclerview

7
推荐指数
2
解决办法
5018
查看次数