StaggeredGridActivity.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:RecyclerViewAnimation 作者:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_grid);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mRecyclerView = (StaggeredGridRecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
    mStaggeredGridAdapter = new StaggeredGridAdapter();
    mStaggeredGridAdapter.setDataSet(mockData());
    mRecyclerView.setAdapter(mStaggeredGridAdapter);
    LayoutAnimationController controller = MyLayoutAnimationHelper.makeLayoutAnimationController();
    ViewGroup viewGroup = (ViewGroup) findViewById(R.id.root_view);
    viewGroup.setLayoutAnimation(controller);
    viewGroup.scheduleLayoutAnimation();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号