Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-9880

Android: custom title bar is not updated on device orientation change


    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: Release 2.1.0, Release 2.0.1, Release 3.2.0
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Titanium SDK: 2.0.1
      Platform OS: Android
      Platform OS Version: 2.2


      Problem description

      When a custom background image is set for the title bar in Android, the image is not updated when the device is rotated. Opening a window with the right orientation, opens the right image inside the drawable-land or drawable-port directory, but that is not updated when orientation changes after the window has been open.

      Steps to reproduce

      1. Create an app with the code below:

      var tabGroup = Titanium.UI.createTabGroup();
      var win1 = Ti.UI.createWindow({
      	navBarHidden: true,
      	tabBarHidden: true,
      var win2 = Ti.UI.createWindow({
      	navBarHidden: false,
      	tabBarHidden: true,
      	backgroundColor: 'white',
      	title: null
      var btn = Ti.UI.createButton({
      	title: 'Open'
      btn.addEventListener('click', function() {
      	tabGroup.activeTab.open(win2, {
      		animated: true
      var tab1 = Titanium.UI.createTab({  
          title:'Tab 1',

      2. Be sure to put 2 different images (one large for landscape, one narrow for portrait) for the title bar under:

      • platform/android/res/drawable-land/fullnavimage.png
      • platform/android/res/drawable-port/fullnavimage.png

      3. Set a custom theme by creating a platform/android/res/values/themes.xml file like this:

      	<!-- Changes the background of the title bar -->
           <style name="CustomWindowTitleBackground">
                 <item name="android:background">@drawable/fullnavimage</item>
          <style name="MyThemes" parent="android:Theme">
          	<item name="android:windowNoTitle">false</item>
              <item name="android:windowTitleSize">45dip</item>
              <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
          <style name="Theme.Titanium" parent="android:Theme.NoTitleBar"></style>

      4. Open the app with the device in portrait and click the 'Open' button

      5. Rotate the device in landscape: the customized title bar does not change, but the portrait one appeares stretched.

      6. Keeping the device in landscape, go back, click 'Open' again: the custom image now shows correctly, but going back to portrait gives the same problem as in #5

      Expected result

      Rotating the device shows the correct customized image


          Issue Links



              • Assignee:
                ybanev Yordan Banev
                dcassenti Davide Cassenti
              • Watchers:
                0 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    Sync status:
                    Last received:
                    Last sent:

                    Git Integration