diff options
author | Gilles Debunne <debunne@google.com> | 2010-12-14 19:26:37 -0800 |
---|---|---|
committer | Gilles Debunne <debunne@google.com> | 2010-12-15 12:16:18 -0800 |
commit | 0e23ab70919739995a2e2612ddd1dfc2ad3bae76 (patch) | |
tree | 477e49bd320f2a3cdda0f45f5c9fc6dc1fc59d02 | |
parent | 7dddf275cd7aa3b44ebeea1e34346f0a31308649 (diff) | |
download | frameworks_base-0e23ab70919739995a2e2612ddd1dfc2ad3bae76.zip frameworks_base-0e23ab70919739995a2e2612ddd1dfc2ad3bae76.tar.gz frameworks_base-0e23ab70919739995a2e2612ddd1dfc2ad3bae76.tar.bz2 |
Support custom themes in TabHost.
CL 76118 introduced style customized tab layout. However, applications
which tabWidgetStyle has been overriden and does not inherit from
Widget.TabWidget will not be able to access tabLayout. Use the default
holo layout for these.
Bug 3235944
Change-Id: I5666c5ef2886060a2175a3d642b012cdaf0a1d50
-rw-r--r-- | core/java/android/widget/TabHost.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 2949208..03eea66 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -79,12 +79,14 @@ public class TabHost extends FrameLayout implements ViewTreeObserver.OnTouchMode com.android.internal.R.attr.tabWidgetStyle, 0); mTabLayoutId = a.getResourceId(R.styleable.TabWidget_tabLayout, 0); + a.recycle(); + if (mTabLayoutId == 0) { - throw new IllegalArgumentException("Invalid TabWidget tabLayout id"); + // In case the tabWidgetStyle does not inherit from Widget.TabWidget and tabLayout is + // not defined. + mTabLayoutId = R.layout.tab_indicator_holo; } - a.recycle(); - initTabHost(); } |