Open
Description
Step to reproduce
- Tap on the 1st item to expand.
- Scroll to the bottom
- Scroll to the top
- The 1st item expand state is gone.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.list_item, null);
}
((TextView)convertView.findViewById(R.id.title)).setText(getItem(position));
// Resets the toolbar to be closed
View toolbar = convertView.findViewById(R.id.toolbar);
((LinearLayout.LayoutParams) toolbar.getLayoutParams()).bottomMargin = -50;
toolbar.setVisibility(View.GONE);
return convertView;
}
I guess this is cause by View re-using. However, if we remove the code
toolbar.setVisibility(View.GONE);
We will encounter another set of problem
- Tap on the 1st item to expand.
- Scroll to the bottom
- We will encounter some items other than 1st is expanded.
Metadata
Metadata
Assignees
Labels
No labels