点击事件
Reginer opened this issue · 3 comments
Reginer commented
Activity中怎么获取item中子控件的点击事件?类似adapter的item的点击事件这种。
qyxxjd commented
这样可以满足需求不?
public class YourAdapter extends CommonAdapter<YourObject> {
private Context mContext;
public YourAdapter(Context context) {
super(context, R.layout.your_layout);
this.mContext = context;
}
@Override public void onUpdate(BaseAdapterHelper helper, YourObject item, int position) {
helper.setOnClickListener(R.id.item_view_id, new View.OnClickListener() {
@Override public void onClick(View v) {
//TODO ...
// sample 1: Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
// sample 2: ((Activity)mContext).startActivity(intent);
}
});
}
}
Reginer commented
这种的不行,事件处理在adapter里了。不过我现在改好了。在adapter里加了个onItemChildClickListener
qyxxjd commented
好的