Skip to content

Commit 05c8277

Browse files
committed
Fix bug 5521467 - Monkeys and ActionBar custom tab views
Remove custom tab views from old parents if applicable. Change-Id: I7892f0f271e91a4fc9e26694557e82b81f3fd31a
1 parent 7859c18 commit 05c8277

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/java/com/android/internal/widget/ScrollingTabContainerView.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import android.view.Gravity;
3030
import android.view.View;
3131
import android.view.ViewGroup;
32+
import android.view.ViewParent;
3233
import android.view.animation.DecelerateInterpolator;
3334
import android.widget.AdapterView;
3435
import android.widget.BaseAdapter;
@@ -392,7 +393,11 @@ public void update() {
392393
final ActionBar.Tab tab = mTab;
393394
final View custom = tab.getCustomView();
394395
if (custom != null) {
395-
addView(custom);
396+
final ViewParent customParent = custom.getParent();
397+
if (customParent != this) {
398+
if (customParent != null) ((ViewGroup) customParent).removeView(custom);
399+
addView(custom);
400+
}
396401
mCustomView = custom;
397402
if (mTextView != null) mTextView.setVisibility(GONE);
398403
if (mIconView != null) {

0 commit comments

Comments
 (0)