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

Android: Toolbar height set to Ti.UI.SIZE won't resize when changing orientation

    Details

    • Story Points:
      13
    • Sprint:
      2018 Sprint 21, 2018 Sprint 22

      Description

      Summary:
      Android Toolbars (and ActionBars) are supposed to use a height of 56dp for portrait orientation and 48dp for landscape. If a Toolbar's "height" is set to Ti.UI.SIZE (the default), then the height and its font size should automatically change when the orientation changes. It currently does not.

      Steps to reproduce:

      1. Position an Android device in portrait.
      2. Build and run the below code on that Android device.
      3. Note the height of the top toolbar.
      4. Rotate the device to landscape.
      5. Notice that toolbar height does not shrink. (This is the bug.)
      6. Keep holding the device at landscape and back out of the app.
      7. Launch the app in landscape form.
      8. Notice that the toolbar height is smaller upon launch.
      9. Rotate the device to portrait.
      10. Notice that the toolbar height has not increased. (This is the bug.)

      var window = Ti.UI.createWindow({
      	theme: "Theme.AppCompat.NoTitleBar",
      });
      var toolbar = Ti.UI.createToolbar({
      	title: "My Toolbar",
      	top: 0,
      	width: Ti.UI.FILL,
      	height: Ti.UI.SIZE,
      });
      window.activity.supportToolbar = toolbar;
      window.add(toolbar);
      window.open();
      

      Cause:
      The height is not changing because Titanium override the activity's "configChanges" for orientation in the "AndroidManifest.xml". This is needed to prevent the UI from being torn down upon orientation change. Google designed it to reload UI from XML, but since Titanium's UI is generated dynamically via code, this is not an option. We have to resize the height ourselves.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                jquick Joshua Quick
                Reviewer:
                Yordan Banev
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code