{ "id": "63922", "key": "TIMOB-3290", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11245", "name": "Sprint 2011-10", "archived": true, "released": true, "releaseDate": "2011-03-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:01:23.000+0000", "created": "2011-04-15T03:41:27.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "defect", "release-1.6.1", "release-1.7.0", "reported-1.6.0", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-04-17T02:01:23.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

For an activity window to be translucent, Android appears to\nrequire that you set the activity's theme to a translucent theme in\nthe AndroidManifest.xml -- \nit does not appear to be possible to successfully set a translucent\ntheme -- or a transparent window background -- at runtime.

\n

You could, for example, use a custom AndroidManifest.xml in your\nTitanium application and set the TiActivity as such:

\n
\n<activity android:configChanges=\"keyboardHidden|orientation\" android:name=\"ti.modules.titanium.ui.TiActivity\" android:theme=\"@android:style/Theme.Translucent\"/>\n
\n

TiActivity is the activity we use for all \"heavyweight\" windows\nin Titanium. The above change to the TiActivity's manifest entry --\nadding\nandroid:theme=\"@android:style/Theme.Translucent\"\nsuccessfully makes your windows translucent by default. (In code,\nyou can then give a backgroundColor to a window if you\ndon't want it to be translucent.)

\n

When you use a TabGroup, however, you need to consider the theme\nfor the TiTabActivity, which is the\nactivity we use for TabGroups. So this should\nwork:

\n
\n<activity android:configChanges=\"keyboardHidden|orientation\" android:name=\"ti.modules.titanium.ui.TiTabActivity\" android:theme=\"@android:style/Theme.Translucent\"/>\n
\n

But, in fact, it's not working. The reason is because we\nexplicitly -- in our Java code -- set the Android TabHost's\nbackground drawable to a ColorDrawable with color\nvalue #ff1a1a1a.

\n

SO ... to re-create the failcase, follow these rather elaborate\nsteps...

\n\n
\nTi.UI.backgroundImage = 'KS_nav_ui.png'; // Set the root background to show an (ugly, stretched) image\nvar tabGroup = Titanium.UI.createTabGroup();\nvar win1 = Titanium.UI.createWindow({  \n    title:'Tab 1',\n    backgroundColor:'transparent'\n});\nvar tab1 = Titanium.UI.createTab({  \n    icon:'KS_nav_views.png',\n    title:'Tab 1',\n    window:win1\n});\nvar win2 = Titanium.UI.createWindow({  \n    title:'Tab 2',\n    backgroundColor:'transparent'\n});\nvar tab2 = Titanium.UI.createTab({  \n    icon:'KS_nav_ui.png',\n    title:'Tab 2',\n    window:win2\n});\ntabGroup.addTab(tab1);  \ntabGroup.addTab(tab2);  \ntabGroup.open();\n
\n\n
\n<activity android:configChanges=\"keyboardHidden|orientation\" android:name=\"ti.modules.titanium.ui.TiTabActivity\" android:theme=\"@android:style/Theme.Translucent\"/>\n
\n
{html}", "attachment": [], "flagged": false, "summary": "Android: TabGroup never translucent even if translucent theme applied to TiTabActivity", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "130480", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [843c806d1c07731e5bd6643b37ce5015e0134695])\nIf TabGroup passed a backgroundColor, use it instead of the default\n#ff1a1a1a we've been setting. This allows people to set\n'transparent', for example, and then use Theme.Translucent on\nTiTabActivity to let their tabs be transparent. Also remove\nduplicate entries from generated AndroidManifest.xml in case user\nputs one of our default activities into of tiapp.xml (such as if\nthey wanted to apply a custom theme to it.) [#3290]\n\nhttps://github.com/appcelerator/titanium_mobile/commit/843c806d1c07...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:41:27.000+0000", "updated": "2011-04-15T03:41:27.000+0000" }, { "id": "130481", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [0a693f4dae443f4381269afebbcdffd24e5e8100])\nIf TabGroup passed a backgroundColor, use it instead of the default\n#ff1a1a1a we've been setting. This allows people to set\n'transparent', for example, and then use Theme.Translucent on\nTiTabActivity to let their tabs be transparent. Also remove\nduplicate entries from generated AndroidManifest.xml in case user\nputs one of our default activities into of tiapp.xml (such as if\nthey wanted to apply a custom theme to it.) [#3290]\n\nhttps://github.com/appcelerator/titanium_mobile/commit/0a693f4dae44...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:41:27.000+0000", "updated": "2011-04-15T03:41:27.000+0000" }, { "id": "130482", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

So with this fix in place, here are the instructions for getting\n(and testing) transparent tab windows:

\n\n
\n<android xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <manifest>\n        <application>\n            <activity android:name=\"ti.modules.titanium.ui.TiTabActivity\"\n                android:configChanges=\"keyboardHidden|orientation\"\n                android:theme=\"@android:style/Theme.Translucent\"\n            />\n        </application>\n    </manifest>\n</android>\n
\n\n
\nTi.UI.backgroundImage = 'KS_nav_ui.png';\nvar tabGroup = Titanium.UI.createTabGroup({backgroundColor: 'transparent'});\nvar win1 = Titanium.UI.createWindow({  \n    title:'Tab 1',\n    backgroundColor:'transparent',\n    fullscreen:false\n});\nvar tab1 = Titanium.UI.createTab({  \n    icon:'KS_nav_views.png',\n    title:'Tab 1',\n    window:win1\n});\nvar win2 = Titanium.UI.createWindow({  \n    title:'Tab 2',\n    backgroundColor:'transparent',\n    fullscreen:false\n});\nvar tab2 = Titanium.UI.createTab({  \n    icon:'KS_nav_ui.png',\n    title:'Tab 2',\n    window:win2\n});\ntabGroup.addTab(tab1);  \ntabGroup.addTab(tab2);  \ntabGroup.open();\n
\n
{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:41:28.000+0000", "updated": "2011-04-15T03:41:28.000+0000" }, { "id": "130483", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested with Titanium SDK version: 1.7.0 (03/08/11 13:41 1dbf930)\non
\nSamsung Galaxy 2.2
\nNexus One 2.2.2
\nEmulator 2.1

{html}", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:41:28.000+0000", "updated": "2011-04-15T03:41:28.000+0000" }, { "id": "130484", "author": { "name": "dennisschneider", "key": "dennisschneider", "displayName": "Dennis Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Hi Bill,

\n

I tried the code above and it works, but on my HTC Desire HD\nit's always in fullscreen mode. The bar at the top is missing.\nSometimes the empty bar pops up and disappears again a few seconds\nlater.

\n

Kind regards,
\nDennis

{html}", "updateAuthor": { "name": "dennisschneider", "key": "dennisschneider", "displayName": "Dennis Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:41:29.000+0000", "updated": "2011-04-15T03:41:29.000+0000" }, { "id": "130485", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

Yup, Android has an annoyance whereby if you open a translucent\nwindow from a fullscreen window, then the translucent window will\nalso be fullscreen, even if you don't want it to be. :\\\nIt's really annoying. There appears to be no way around it.

\n

So what's happening is that since the \"launch\" theme is\nfullscreen (the fullscreen splash screen), the translucent \"window\"\n(the TabGroup) which gets launched from it is also fullscreen. It\ndoesn't happen for non-translucent windows. Very weird.

\n

There are a couple of things you can try. The first one works\nfor sure, the second one I haven't tried.

\n
    \n
  1. \n

    Change the launch theme to not be fullscreen.\nIf you look in the generated AndroidManifest.xml, you'll see that\nthe first activity definition -- the one that carries your\napplication's name -- has\nandroid:theme=\"@style/Theme.Titanium. Now if you look\nat build/android/res/values/theme.xml, you'll see that\nTheme.Titanium inherits from the Android built-in\ntheme named Theme.NoTitleBar.Fullscreen. You can make\na custom version of this theme.xml:

    \n
      \n
    • In your project root, create\nplatform/android/res/values, then copy this theme.xml\nfile into that folder and edit it.
    • \n
    • Change the Theme.NoTitleBar.Fullscreen to\nTheme.NoTitleBar and save the file.
    • \n
    • Now \"touch\" your tiapp.xml file (i.e, do something to update\nits file date/time). I'm not sure this step is necessary, but it's\na good idea in this case.
    • \n
    • Re-launch your app. You'll see that your splash screen is no\nlonger fullscreen (which might be annoying), but also your\ntranslucent TabGroup will not be fullscreen anymore.
    • \n
    \n
  2. \n
  3. \n

    Keep the launch screen as a fullscreen, but put a\nnon-fullscreen-window between the launch window (splash) and the\ntabgroup. I have not tried this. For example, in\napp.js you'd createWindow({fullscreen:false,\nurl:'launch.js'}) (etc.), then launch.js you'd have the code\nto open the TabGroup immediately. (For createTabGroup, you would\nwant to also set exitOnClose:true so that the app\ncloses when you back out of the TabGroup -- otherwise you would end\nup setting at that launch.js window which is useless.)

    \n
  4. \n
\n

Hope that helps,

\n

Bill

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:41:29.000+0000", "updated": "2011-04-15T03:41:29.000+0000" }, { "id": "130486", "author": { "name": "dennisschneider", "key": "dennisschneider", "displayName": "Dennis Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Hi Bill,

\n

the first approach works great so far! But as soon as I put the\ndevice to the landscape mode the splash screen covers the root\nbackground. I was able to use a workaround by setting the\nbackground image again on orientationchange, but sometimes this\ndoesn't work as desired.

\n

Would it be possible that I add you to my contacts in Skype? I\nhave some more bugs to share ;) Maybe you can send your Skype name\nby email to dennis@wunderkinder.com. That\nwould be really great!!

\n

Thank you very much

\n

Kind regards,
\nDennis

{html}", "updateAuthor": { "name": "dennisschneider", "key": "dennisschneider", "displayName": "Dennis Schneider", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:41:29.000+0000", "updated": "2011-04-15T03:41:29.000+0000" }, { "id": "130487", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [0cfa014353f9af858ff975a9ae1eb6823ced0966])\nIf TabGroup passed a backgroundColor, use it instead of the default\n#ff1a1a1a we've been setting. This allows people to set\n'transparent', for example, and then use Theme.Translucent on\nTiTabActivity to let their tabs be transparent. Also remove\nduplicate entries from generated AndroidManifest.xml in case user\nputs one of our default activities into of tiapp.xml (such as if\nthey wanted to apply a custom theme to it.) [#3290]\n\nhttps://github.com/appcelerator/titanium_mobile/commit/0cfa014353f9...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:41:29.000+0000", "updated": "2011-04-15T03:41:29.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }