OSDN Git Service

Fix Spinner not restoring selection when set to GONE
authorDoris Liu <tianliu@google.com>
Wed, 9 Sep 2015 20:59:32 +0000 (13:59 -0700)
committerDoris Liu <tianliu@google.com>
Sat, 12 Sep 2015 01:03:28 +0000 (18:03 -0700)
This CL restores the selected position when AdapterView
gets restored, rather than wait until the next measure/layout
pass to do it. After the change, even when the AdapterView
is set to GONE (i.e. no measure/layout pass), the selection
will still be kept up to date.

Bug: 23619366

Change-Id: I09a31b6e2a61ca0edf129af8fe634b83784f9167

core/java/android/widget/AdapterView.java

index 0cc1b25..27a0f80 100644 (file)
@@ -808,6 +808,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
     @Override
     protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) {
         dispatchThawSelfOnly(container);
+        handleDataChanged();
     }
 
     class AdapterDataSetObserver extends DataSetObserver {