diff options
author | Jeff Sharkey <jsharkey@android.com> | 2011-08-08 21:05:40 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2011-08-15 15:49:48 -0700 |
commit | 11f4a48c54f3006778c874662ff04a4d9d157f25 (patch) | |
tree | ea1c87a38a861b9e4c44339ab62a478a80e53e96 /core/java/android/widget/TabHost.java | |
parent | dd7bc9f457204e60feeea53b0b12ba706d6964df (diff) | |
download | frameworks_base-11f4a48c54f3006778c874662ff04a4d9d157f25.zip frameworks_base-11f4a48c54f3006778c874662ff04a4d9d157f25.tar.gz frameworks_base-11f4a48c54f3006778c874662ff04a4d9d157f25.tar.bz2 |
Adjust holo tabs to match spec.
Change-Id: I8653ab10cd45bed3c38b15362e80af6c3319f763
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); } |