sergejsha / pinned-section-listview

Easy to use ListView with pinned sections for Android.
2.59k stars 808 forks source link

section can't reserve its status #81

Open AndyGu opened 8 years ago

AndyGu commented 8 years ago

I set a textview in section , then set a clicklistener of it so it can change its background when I click it. But after I scroll the list, I found that the section can't reserve its status. After the section get to the top of the list, or scroll down when section was on the top of the list, it turned to be the orign background color, pls help check this issue

sergejsha commented 8 years ago

Not the best solution, but you could call notifyDataChanged() which should cause pinned section view to be recreated from the changed section view.

Firoz-Shaikh commented 6 years ago

Where can I set notifyDataChanged() ?

Depp-Jay commented 6 years ago

You can mark the textview state when onClick. Refresh the state in adapter getView() For example:

public View getView(int position, View convertView, ViewGroup parent) {
   switch(viewType) {
        case HEADER_VIEW:
            //init view

            //refresh state
            refreshState(state);

            //set click event
            textView.setOnClickListener(v -> {
                //mark the state
                int state = 1;
            });

    }
}