Want to improve this question? 想改善這個問題嗎? Update the question so it can be answered with facts and citations by editing this post . 更新問題,以便經過編輯此帖子以事實和引用的形式回答。 android
Closed 4 months ago . 4個月前關閉。 ide
I was exploring RecyclerView
and I was surprised to see that RecyclerView
does not have onItemClickListener()
. 我在瀏覽RecyclerView
,驚訝地發現RecyclerView
沒有onItemClickListener()
。 Because RecyclerView
extends 因爲RecyclerView
擴展 post
android.view.ViewGroup android.view.ViewGroup 性能
and ListView
extends 和ListView
擴展 this
android.widget.AbsListView android.widget.AbsListView spa
. 。 However I solved my problem by writing onClick
in my RecyclerView.Adapter
: 可是我經過在RecyclerView.Adapter
編寫onClick
解決了個人問題: .net
public static class ViewHolder extends RecyclerView.ViewHolder implements OnClickListener { public TextView txtViewTitle; public ImageView imgViewIcon; public ViewHolder(View itemLayoutView) { super(itemLayoutView); txtViewTitle = (TextView) itemLayoutView.findViewById(R.id.item_title); imgViewIcon = (ImageView) itemLayoutView.findViewById(R.id.item_icon); } @Override public void onClick(View v) { } }
But still I want to know why Google removed onItemClickListener()
? 可是我仍然想知道爲何Google刪除了onItemClickListener()
? code
Is there a performance issue or something else? 是否存在性能問題或其餘問題? orm