单击适配器时如何更改文本按钮 我试着这不行
public void setQuestData(final ViewHoder viewHoder, final int position) {
viewHoder.btn_select_qq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!profileFeedListModelTwos.get(position).getStatus_select().equalsIgnoreCase("SELECTED")){
viewHoder.btn_select_qq.setText("Accepted");
notifyDataSetChanged();
}
notifyDataSetChanged();
}
});
如何解决?我的问题在哪里?
答案 0 :(得分:0)
基本理念
adapter = new Adapter(enter code here
用于设置点击监听器)
在YourAdapter中只需将clickListener设置为您的视图
即可viewHoder.btn_select_qq.setOnClickListener(this)
片段内处理点击
上的操作YourAdapter adapter = new YourAdapter(getActivity(),new BaseRecyclerViewAdapter.OnRecyclerViewInteractionListener() {
@Override
public void onClick(View view) {
int position = (int) view.getTag();
ItemObject item =adapter .getItem(position);
switch (view.getId()) {
case R.id.view1:
//TODO write logic here
break;
case R.id.view2:
//TODO write logic here
break;
case R.id.view3:
//TODO write logic here
break;
}
}
});