summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-04-29 09:59:53 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2009-04-29 09:59:53 -0700
commitc5f1b92d0a480f3119be8ea6eebbada402c17cf3 (patch)
tree47dc21505e15d42d96052f2600d2e1207a86c862
parent203464af9638e4d5aecd811452af67fff9aa3087 (diff)
parent2e447d46d9936c325fe5209262564fc3c5e795a2 (diff)
Merge change 691 into donut
* changes: Fixes 1819406. Take a ListView, add headers/footers, set the adapter after at least one layout pass, and the headers/footers don't know they have a parent anymore. Which causes a lot of trouble, like drawing not happening.
-rw-r--r--core/java/android/widget/ListView.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 1daee4e2c7e0..66c162eefc6d 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -460,10 +460,30 @@ public class ListView extends AbsListView {
*/
@Override
void resetList() {
+ // The parent's resetList() will remove all views from the layout so we need to
+ // cleanup the state of our footers and headers
+ clearRecycledState(mHeaderViewInfos);
+ clearRecycledState(mFooterViewInfos);
+
super.resetList();
+
mLayoutMode = LAYOUT_NORMAL;
}
+ private void clearRecycledState(ArrayList<FixedViewInfo> infos) {
+ if (infos != null) {
+ final int count = infos.size();
+
+ for (int i = 0; i < count; i++) {
+ final View child = infos.get(i).view;
+ final LayoutParams p = (LayoutParams) child.getLayoutParams();
+ if (p != null) {
+ p.recycledHeaderFooter = false;
+ }
+ }
+ }
+ }
+
/**
* @return Whether the list needs to show the top fading edge
*/