tjerkw / Android-SlideExpandableListView

A better ExpandableListView, with animated expandable views for each list item
Apache License 2.0
1.98k stars 741 forks source link

Why refresh 3 times AbstractSlideExpandableListAdapter‘s getView #30

Closed wuyexiong closed 11 years ago

wuyexiong commented 11 years ago
public View getView(int position, View view, ViewGroup viewGroup) {
        view = wrapped.getView(position, view, viewGroup);
        enableFor(view, position);
        Log.v(TAG, "getView" + position);
        return view;
    }

Log

05-13 18:24:03.092: V/AbstractSlideExpandableListAdapter(21527): getView0
05-13 18:24:03.092: V/AbstractSlideExpandableListAdapter(21527): getView1
05-13 18:24:03.092: V/AbstractSlideExpandableListAdapter(21527): getView2
05-13 18:24:03.102: V/AbstractSlideExpandableListAdapter(21527): getView3
05-13 18:24:03.102: V/AbstractSlideExpandableListAdapter(21527): getView4
05-13 18:24:03.102: V/AbstractSlideExpandableListAdapter(21527): getView5
05-13 18:24:03.102: V/AbstractSlideExpandableListAdapter(21527): getView6
05-13 18:24:03.112: V/AbstractSlideExpandableListAdapter(21527): getView7
05-13 18:24:03.112: V/AbstractSlideExpandableListAdapter(21527): getView8
05-13 18:24:03.112: V/AbstractSlideExpandableListAdapter(21527): getView0
05-13 18:24:03.122: V/AbstractSlideExpandableListAdapter(21527): getView1
05-13 18:24:03.122: V/AbstractSlideExpandableListAdapter(21527): getView2
05-13 18:24:03.122: V/AbstractSlideExpandableListAdapter(21527): getView3
05-13 18:24:03.122: V/AbstractSlideExpandableListAdapter(21527): getView4
05-13 18:24:03.132: V/AbstractSlideExpandableListAdapter(21527): getView5
05-13 18:24:03.132: V/AbstractSlideExpandableListAdapter(21527): getView6
05-13 18:24:03.132: V/AbstractSlideExpandableListAdapter(21527): getView7
05-13 18:24:03.132: V/AbstractSlideExpandableListAdapter(21527): getView8
05-13 18:24:03.142: V/AbstractSlideExpandableListAdapter(21527): getView0
05-13 18:24:03.152: V/AbstractSlideExpandableListAdapter(21527): getView1
05-13 18:24:03.162: V/AbstractSlideExpandableListAdapter(21527): getView2
05-13 18:24:03.172: V/AbstractSlideExpandableListAdapter(21527): getView3
05-13 18:24:03.182: V/AbstractSlideExpandableListAdapter(21527): getView4
05-13 18:24:03.192: V/AbstractSlideExpandableListAdapter(21527): getView5
05-13 18:24:03.202: V/AbstractSlideExpandableListAdapter(21527): getView6
05-13 18:24:03.212: V/AbstractSlideExpandableListAdapter(21527): getView7
05-13 18:24:03.222: V/AbstractSlideExpandableListAdapter(21527): getView8
JesseFarebro commented 11 years ago

This is not an issue with the library what so ever. This has to do with the underlying framework and in your view you probably have the width or height of the root view to wrap content which makes Android draw then redraw to continue calculating the bounds with child views. This is more so a question for stack overflow.

sergiandreplace commented 10 years ago

Adding a comment for this.

Something similar was happening to me. Also, first half of items were not correctly collapsing when expanding other. After reading this, I've found that the list acts weird if the width and height are not fill_parent (or match_parent) both of them. Maybe will be nice to add a note in the readme.md instructions.