Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3204] Android: Titanium.UI.backgroundImage Not Implemented

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T02:01:10.000+0000
Affected Version/sn/a
Fix Version/sSprint-2011-09
ComponentsAndroid
Labelsandroid, defect, release-1.7.0, reported-1.6.0, rplist
ReporterDawson Toth
AssigneeDon Thorp
Created2011-04-15T03:39:23.000+0000
Updated2011-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

Comments

  1. Bill Dawson 2011-04-15

    (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...

  2. Natalie Huynh 2011-04-15

    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

  3. Bill Dawson 2011-04-15

    (from [cef1964e701d64deff2ba2590fe2bee49fed88a4]) Support backgroundImage on root UI view. Document UI.backgroundImage and UI.backgroundColor. [#3204 state:fixed-in-qa]

    resolved Conflicts:

       android/modules/ui/src/ti/modules/titanium/ui/UIModule.java
       

    https://github.com/appcelerator/titanium_mobile/commit/cef1964e701d64deff2ba2590fe2bee49fed88a4"> https://github.com/appcelerator/titanium_mobile/commit/cef1964e701d...

  4. Bill Dawson 2011-04-15

    set back to "resolved" (was set back to fixed-in-qa by agent after cherry pick)

  5. Dennis Schneider 2011-04-15

    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

  6. Bill Dawson 2011-04-15

    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.

  7. Dennis Schneider 2011-04-15

    Hi Bill,

    I am actually using the window property of tabs

       tabsObject['lists'] =  Ti.UI.createTab({
           icon   : Titanium.Filesystem.resourcesDirectory + '/images/tab-lists.png',
           title  : wunderlist.language.data.lists,
           type   : 'lists',
           window : tabs.createWindow('lists')
       });
       

    tabs.createWindow() returns a window like that:

       tabsWindow = Ti.UI.createWindow({
           url             : Titanium.Filesystem.resourcesDirectory + '/js/windows/lists.js',
           backgroundColor : 'transparent'
       });
       

    I am always setting the backgroundColor to 'transparent' so that the background isn't visible.

  8. Bill Dawson 2011-04-15

    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

  9. Dennis Schneider 2011-04-15

    Hi Bill,

    that's just awesome :)
    Thank you very much for your help!

    Kind reagards,
    Dennis

JSON Source