一行Java代码实现RecyclerView的Adapter?一行都不需要!
单类型列表的实现 先看下MainActivity的java代码 public class MainActivity extends AppCompatActivity { //要展示的数据源 public final ObservableArrayList<Student> showDatas = new ObservableArrayList<>(); { //初始化数据源 for (int i = 0; i < 20; i++) { students.add(new Student("学生:" + i)); } showDatas.addAll(students); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //完成数据和布局的绑定 ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); binding.setActivity(this); } public void onBindItem(ViewDataBinding binding, Object data, int position) {