Skip to content

Commit fb0784d

Browse files
adampAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug 5521467 - Monkeys and ActionBar custom tab views" into ics-mr1
2 parents 043a8b1 + 05c8277 commit fb0784d

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)