In my recyclerview onBindView method, i have this piece of code:
holder.linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// execute the code inside the onCheckedChanged method
}
});
And then i also have this
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// do something
}
});
I'm doing this because i need padding around the checkbox (linear layout), but i need the checkbox to stay the same during scrolling by using OnCheckedChangedListener
. I need to use the boolean isChecked
parameter to execute my further code.
How can i execute the code inside the onCheckedChanged by clicking on the linear layout and not on the checkbox?
Aucun commentaire:
Enregistrer un commentaire