我是新來的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