封装Adapter的使用[ListView]

封装库地址

https://github.com/hongyangAndroid/baseAdapter

导包

ForRecyclerView

compile 'com.android.support:recyclerview-v7:24.+'
compile 'com.zhy:base-rvadapter:3.0.3'

简单用法

recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
        recyclerView.setAdapter(new CommonAdapter(MainActivity.this,R.layout.item_layout,list) {
            @Override
            protected void convert(ViewHolder holder, String s, int position) {
                    holder.setText(R.id.tv_name,s);
            }
        });

你可能感兴趣的:(封装Adapter的使用[ListView])