'u kullanarak programlı olarak yöntemi tıklatıp arama işlevi arıyorum. bu yüzden bir yöntem buldum. 'PerformClick()' böyleRecyclerViewProgramı tıklatarak tıklayın -
:
recyclerView.findViewHolderForAdapterPosition(position).itemView.performClick();
ama benim durumumda çalışmalarını kaplamaz. Çözüm bulamıyorum. ActivityClick eylemini nasıl kullanırım ???
benim Adaptör - ViewHolder:
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView virtNo;
private TextView score01;
private TextView score02;
private TextView score03;
private TextView totalScore;
private LinearLayout linearLayout;
public ViewHolder(View itemView) {
super(itemView);
this.virtNo = (TextView) itemView.findViewById(R.id.tv_virtNo);
this.score01 = (TextView) itemView.findViewById(R.id.tv_score01);
this.score02 = (TextView) itemView.findViewById(R.id.tv_score02);
this.score03 = (TextView) itemView.findViewById(R.id.tv_score03);
this.totalScore = (TextView) itemView.findViewById(R.id.tv_totalScore);
this.linearLayout = (LinearLayout) itemView.findViewById(R.id.ll_item_score);
virtNo.setOnClickListener(this);
score01.setOnClickListener(this);
score02.setOnClickListener(this);
score03.setOnClickListener(this);
score10.setOnClickListener(this);
}
@Override
public void onClick(View v) {
onClickListener.onClick(v, getAdapterPosition(), items.get(getAdapterPosition()));
}
}
public void setOnClickListener(OnClickListener<Score> onClickListener) {
this.onClickListener = onClickListener;
}
public interface OnClickListener<T> {
void onClick(View v, int position, T item);
}
benim Adaptör - Burada anlaşılması kolay tutmak için çalıştık
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Score item = items.get(position);
holder.virtNo.setText(item.virtNo);
holder.score01.setText(item.score01);
holder.score02.setText(item.score02);
holder.score03.setText(item.score03);
holder.totalScore.setText(itemSum(item));
}
}
de mevcuttur, ama ... biraz garip bir yol ... neyse, ben ... çok zor bir hayat çözüldü ... –
Bunu nasıl çözdünüz? Ben bilmek için çok hevesliyim. –
@AliNfr Çok iyi ingilizce yazamam, bu yüzden size açıklayamam. çok özür dilerim ... ve şimdi benim kodumu anlamıyorum .. ㅠㅠ çok üzgünüm ... –