diff options
Diffstat (limited to 'core/java/android/widget/TabHost.java')
-rw-r--r-- | core/java/android/widget/TabHost.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 57a8531..88d7230 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -24,6 +24,7 @@ import android.content.Intent; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Build; +import android.text.TextUtils; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -566,10 +567,15 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); false); // no inflate params final TextView tv = (TextView) tabIndicator.findViewById(R.id.title); + final ImageView iconView = (ImageView) tabIndicator.findViewById(R.id.icon); + + // when icon is gone by default, we're in exclusive mode + final boolean exclusive = iconView.getVisibility() == View.GONE; + final boolean bindIcon = !exclusive || TextUtils.isEmpty(mLabel); + tv.setText(mLabel); - final ImageView iconView = (ImageView) tabIndicator.findViewById(R.id.icon); - if (mIcon != null) { + if (bindIcon && mIcon != null) { iconView.setImageDrawable(mIcon); iconView.setVisibility(VISIBLE); } |