I have a ListView where I store a list of order.
When clicking an item, it should expand to let the user see the detail.
The problem is that the item is actually expanding, but so is another item randomly in the list.
If I scroll the list while one item is open, the first item collapse and another take his place. The second expanded item is NEVER in sight, I have to scroll to see it.
I don't understand anything to this bug, can you help me?
Here is the listener that interract with the listview
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
View v = CommandesSalarieActivity.this.list.getChildAt(position);
LinearLayout ll = view.findViewById(R.id.commande_salarie_list_item_layout_main_layout);
ImageView iv = view.findViewById(R.id.commande_salarie_list_item_layout_dropdown);
if (ll.getVisibility() == View.VISIBLE) {
ll.setVisibility(View.GONE);
iv.setImageResource(R.drawable.ic_dropdown_ressource);
} else {
ll.setVisibility(View.VISIBLE);
iv.setImageResource(R.drawable.ic_dropup_ressource);
}
}