Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26713] Android: TabGroup "tabsBackgroundColor" property ignored when landscape

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2019-01-10T23:40:35.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.0.0
ComponentsAndroid
LabelsTabGroup, android, background, color, landscape
ReporterJoshua Quick
AssigneeYordan Banev
Created2019-01-10T23:36:00.000+0000
Updated2019-01-11T01:05:33.000+0000

Description

*Summary:* TabGroup property "tabsBackgroundColor" will only apply the color to the top tab bar's background when the app is shown in "portrait" orientation. When "landscape", the color is ignored and will use the ActionBar's background color instead. Not that this is because the tab bar is moved inside of the ActionBar when landscape. The work-around is to set the ActionBar's "primaryColor" via an XML theme instead. Also, note that implementing tab bars via an ActionBar is considered deprecated as of Android 5.0 as well. *Steps to reproduce:*

Build and run the below code on Android.

Hold the device portrait.

Notice that the top tab bar's background color is red. (This is good.)

Rotate to landscape.

Notice top tab bar is dark gray. (This is the issue.)

function createTab(title) {
	var window = Ti.UI.createWindow({ title: title });
	window.add(Ti.UI.createLabel({ text: title + " View" }));
	var tab = Ti.UI.createTab({
		title: title,
		window: window,
	});
	return tab;
}

var tabGroup = Ti.UI.createTabGroup({
	tabs: [createTab("Tab 1"), createTab("Tab 2")],
	tabsBackgroundColor: "red",
});
tabGroup.open();
*Result:* !TabGroupPortrait-Good.png|thumbnail! !TabGroupLandscape-Bad.png|thumbnail! *Expected Result:* !TabGroupPortrait-Good.png|thumbnail! !TabGroupLandscape-Good.png|thumbnail!

Attachments

FileDateSize
TabGroupLandscape-Bad.png2019-01-10T23:35:25.000+000051548
TabGroupLandscape-Good.png2019-01-10T23:35:25.000+000049984
TabGroupPortrait-Good.png2019-01-10T23:35:25.000+000047607

Comments

  1. Joshua Quick 2019-01-10

    This issue was resolved in Titanium 8.0.0 by [TIMOB-26354]. Note that the new TabGroup implementation no longer adds the top tab bar into the ActionBar. This is considered to be deprecated behavior on Google's end. Also note that Titanium's 8.0.0's new TabGroup implementation allows you to remove the top ActionBar which you can do via theme "Theme.AppCompat.NoTitleBar". This is the recommended thing to do.

JSON Source