summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TabHost.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2010-12-14 19:26:37 -0800
committerGilles Debunne <debunne@google.com>2010-12-15 12:16:18 -0800
commit0e23ab70919739995a2e2612ddd1dfc2ad3bae76 (patch)
tree477e49bd320f2a3cdda0f45f5c9fc6dc1fc59d02 /core/java/android/widget/TabHost.java
parent7dddf275cd7aa3b44ebeea1e34346f0a31308649 (diff)
downloadframeworks_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
Diffstat (limited to 'core/java/android/widget/TabHost.java')
-rw-r--r--core/java/android/widget/TabHost.java8
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();
}