Gingerbread Tabwidget dividers vs ICS and higher

I created tabs with snippets using TabWidget with a custom layout for each tab. Everything seems to work and looks great, except for one. In ICS and above, it looks like this:

enter image description here

But on Gingerbread, it looks like this:

enter image description here

As you can clearly see, the separators disappear in the gingerbread.

So, I have two questions. First of all, is there a way to make dividers on Gingerbread? I tried various stackoverflow suggestions, but they just don't want to appear.

Secondly, is there a way to customize the appearance of the delimiters? I tried using:

setDividerDrawable() 

with images that work on ICS, but I get a null pointer exception in Gingerbread.
(UPDATE: in connection with a bold question, I just discovered something really annoying. It seems that Gingerbread and ICS + deal with delimiters differently. I got a Null pointer exception when calling TabWidget.getChildAt (). When the divisor is set , in Rectangle, the divider is considered to be a child of the Tabwidget in which it is contained, but it is NOT (or ignored) in ICS +. Therefore, the index I use for getChildAt is completely incorrect in Gingerbread, because tabwidget sees 5 children (3 tabs and 2 separators), but in ICS he sees only 3 (only 3 tabs))

I also tried setting the color of the separators, but they don't seem to work at all.

Here's how the tabs are configured:

 /** * Setup the tab host. */ private void initialiseTabHost(Bundle args) { this.tabHost = (TabHost) findViewById(android.R.id.tabhost); this.tabHost.setup(); TabInfo tabInfo = null; addTab( this, this.tabHost, this.tabHost.newTabSpec(TAB_DASHBOARD).setIndicator(LayoutInflater.from(getApplicationContext()) .inflate(R.layout.tabview_dashboard, null)), (tabInfo = new TabInfo(TAB_DASHBOARD, MonitoringTab.class.getName(), args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); //create alert list and alert details fragments, add alert list to the tab bar tabInfo = new TabInfo(TAB_ALERT_DETAILS, AlertDetailTab.class.getName(), args); this.mapTabInfo.put(tabInfo.tag, tabInfo); tabInfo = new TabInfo(TAB_ALERTS, AlertListTab.class.getName(), args); this.mapTabInfo.put(tabInfo.tag, tabInfo); addTab( this, this.tabHost, this.tabHost.newTabSpec(TAB_ALERT_SHOWING).setIndicator(LayoutInflater.from(getApplicationContext()) .inflate(R.layout.tabview_alerts, null)), tabInfo); this.mapTabInfo.put(TAB_ALERT_SHOWING, tabInfo); addTab( this, this.tabHost, this.tabHost.newTabSpec(TAB_ERRORQUEUE).setIndicator(LayoutInflater.from(getApplicationContext()) .inflate(R.layout.tabview_errorqueue, null)), (tabInfo = new TabInfo(TAB_ERRORQUEUE, ErrorMessagesTab.class.getName(), args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); // Default to first tab onTabChanged(TAB_DASHBOARD); this.tabHost.setOnTabChangedListener(this); } 
+4
source share

All Articles