Skip to content

Expand state gone after you perform scrolling #6

Open
@yccheok

Description

@yccheok

Step to reproduce

  1. Tap on the 1st item to expand.
  2. Scroll to the bottom
  3. Scroll to the top
  4. 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

  1. Tap on the 1st item to expand.
  2. Scroll to the bottom
  3. We will encounter some items other than 1st is expanded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions