我是新来的Android编程和正在制定一个卡布局。我想知道,我如何使它可点击?卡片视图点击卡片移动到新活动
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
我在卡片小部件上有这个,然后我想知道在哪里放置可点击的动作?我希望能够点击该卡,它得到了卡的ID,然后显示一个新的意图活动
这是我的活动代码来加载适配器
setContentView(R.layout.activity_my);
RecyclerView recList = (RecyclerView) findViewById(R.id.cardList);
recList.setHasFixedSize(true);
LinearLayoutManager llm = new LinearLayoutManager(this);
llm.setOrientation(LinearLayoutManager.VERTICAL);
recList.setLayoutManager(llm);
ContactAdapter ca = new ContactAdapter(createList(30));
recList.setAdapter(ca);
也许你可以从这里得到一些想法 - > http://stackoverflow.com/questions/24471109/recyclerview-onclick – Alfaplus 2014-12-04 11:32:57