[TIMOB-26713] Android: TabGroup "tabsBackgroundColor" property ignored when landscape
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-01-10T23:40:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.0.0 |
Components | Android |
Labels | TabGroup, android, background, color, landscape |
Reporter | Joshua Quick |
Assignee | Yordan Banev |
Created | 2019-01-10T23:36:00.000+0000 |
Updated | 2019-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
File | Date | Size |
---|---|---|
TabGroupLandscape-Bad.png | 2019-01-10T23:35:25.000+0000 | 51548 |
TabGroupLandscape-Good.png | 2019-01-10T23:35:25.000+0000 | 49984 |
TabGroupPortrait-Good.png | 2019-01-10T23:35:25.000+0000 | 47607 |
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 theActionBar
. This is considered to be deprecated behavior on Google's end. Also note that Titanium's 8.0.0's newTabGroup
implementation allows you to remove the topActionBar
which you can do via theme "Theme.AppCompat.NoTitleBar". This is the recommended thing to do.