[TIMOB-3204] Android: Titanium.UI.backgroundImage Not Implemented
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T02:01:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint-2011-09 |
Components | Android |
Labels | android, defect, release-1.7.0, reported-1.6.0, rplist |
Reporter | Dawson Toth |
Assignee | Don Thorp |
Created | 2011-04-15T03:39:23.000+0000 |
Updated | 2011-04-17T02:01:10.000+0000 |
Description
Problem
iOS supports both Titanium.UI.backgroundImage and Titanium.UI.backgroundColor. Android only supports backgroundColor. I also looked at UIModule.java to verify that setBackgroundColor exists, but setBackgroundImage does not exist (therefore, it is not implemented).
Solution
Add support for backgroundImage to Android, and clarify this feature in the documentation.
Associated Documentation
http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI-module.html"> http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI-...
Sample Code
The following will show a red background with a transparent background over it for iOS. Android only shows a red background. Also note that if you comment out the background color, nothing will show up for Android.
Ti.UI.backgroundColor = '#f00';
Ti.UI.backgroundImage = 'KS_nav_ui.png';
var win = Ti.UI.createWindow();
win.open();
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/75321">http://developer.appcelerator.com/helpdesk/view/75321
(from [5de2dcddcbd74b349e3e766574eba80a40151d6a]) Support backgroundImage on root UI view. Document UI.backgroundImage and UI.backgroundColor. [#3204 state:fixed-in-qa] https://github.com/appcelerator/titanium_mobile/commit/5de2dcddcbd74b349e3e766574eba80a40151d6a"> https://github.com/appcelerator/titanium_mobile/commit/5de2dcddcbd7...
Tested with Titanium SDK version: 1.7.0 (03/04/11 12:06 87eb210) on
Emulator 2.1
Galazy Tab 2.2
iPhone 4 4.2.1
(from [cef1964e701d64deff2ba2590fe2bee49fed88a4]) Support backgroundImage on root UI view. Document UI.backgroundImage and UI.backgroundColor. [#3204 state:fixed-in-qa]
resolved Conflicts:
https://github.com/appcelerator/titanium_mobile/commit/cef1964e701d64deff2ba2590fe2bee49fed88a4"> https://github.com/appcelerator/titanium_mobile/commit/cef1964e701d...
set back to "resolved" (was set back to fixed-in-qa by agent after cherry pick)
Hi Guys,
it works now to put a background image to the root view, but unfortunately it is only possible to set the background when using no tab group or windows. On the iPhone I use the same code with a tab group and can see the background, in Android I can't. Is this due to a technical reason or an unwanted inconsistency?
Thank you very much
Interesting, so you are using tabs without setting their "window" property, is that right? Because I guess if you set the tab's window property, that window's background would cover the default (root) background.
In our Android implementation, I notice if I try to not set a tab's window property, then the app crashes. (It expects that a tab carries a window).
If I'm misinterpreting, maybe you could paste some sample code here.
Hi Bill,
I am actually using the window property of tabs
tabs.createWindow() returns a window like that:
I am always setting the backgroundColor to 'transparent' so that the background isn't visible.
Hi Dennis,
There's a new ticket to follow: #3290 . It will be finished during the day Tuesday. I've already got a working prototype.
Thanks,
Bill
Hi Bill,
that's just awesome :)
Thank you very much for your help!
Kind reagards,
Dennis