1
When setting the setOnClickListener to set the action of an item in my listview, the default animation of the click in the list is lost. I’d like to keep up the excitement and run my routine.
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View item = LayoutInflater.from(context).inflate(resource, parent, false);
item.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//MyActions
}
});
return item;
}
I tried something like super.onClick but it didn’t work. Someone would know how to solve?
Valeeu!
Good night friend.... probably your listview is losing focus. this happens if the items in your listview contain Buttons or imageButtons. Note if this is your case. If yes, add the xml property of Button or imageButton:
focusableInTouch="false"
– André alas
Thanks for the return friend. The item I display is exactly this one that is in the gif. In any case I put android:focusableInTouchMode="false" in Imageview, but did not fix. To make the gif I commented on the part that adds the Listener and then the click effect works again normal. Anyway thank you very much for the strength.
– osmarditto