Search in sources :

Example 1 with SimpleRecyleViewAdapter

use of com.litingzhe.justandroid.ui.listandGridView.adapter.SimpleRecyleViewAdapter in project JustAndroid by chinaltz.

the class SimpleRecyleViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_single_recyclerview);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    navToolBarBack.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolbarTitle.setText("RecycleView简单使用");
    initData();
    mAdapter = new SimpleRecyleViewAdapter(this, mDatas);
    mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL));
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.addItemDecoration(new DividerGridItemDecoration(this));
    // 设置item动画
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    initEvent();
}
Also used : SimpleRecyleViewAdapter(com.litingzhe.justandroid.ui.listandGridView.adapter.SimpleRecyleViewAdapter) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) DividerGridItemDecoration(com.litingzhe.justandroid.ui.listandGridView.recyleDivider.DividerGridItemDecoration) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 RecyclerView (android.support.v7.widget.RecyclerView)1 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)1 View (android.view.View)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 SimpleRecyleViewAdapter (com.litingzhe.justandroid.ui.listandGridView.adapter.SimpleRecyleViewAdapter)1 DividerGridItemDecoration (com.litingzhe.justandroid.ui.listandGridView.recyleDivider.DividerGridItemDecoration)1