1 回答

TA貢獻1906條經(jīng)驗 獲得超10個贊
替換這個
private RecyclerView.Adapter mAdapter;
和
public MyAdapter mAdapter;
并刪除多余的東西并更新如下
private RecyclerView recyclerView;
public MyAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Log.i("MainActivity", "Hello World");
// get the recycler view
recyclerView = (RecyclerView) findViewById(R.id.noodleRecycler);
//specify an adapter
mAdapter = new MyAdapter(noodlesDataset);
LinearLayoutManager layoutManager = new LinearLayoutManager(MainActivity.this);
recyclerView.setAdapter(mAdapter);
recyclerView.setLayoutManager(layoutManager);
添加回答
舉報