Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25810] Android: ActionBar height won't resize on screen rotation

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-10-25T14:06:14.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
ComponentsAndroid
LabelsActionBar, actionbar, android, bug, orientation
ReporterGuillermo Figueras
AssigneeJoshua Quick
Created2018-02-22T10:17:47.000+0000
Updated2018-10-25T17:37:58.000+0000

Description

*Summary:* The ActionBar on Android won't resize when the device rotates. [As seen in Material Design guidelines](https://material.io/guidelines/layout/structure.html#structure-app-bar), when a mobile is on landscape, ActionBar's height is 48dp, while on portrait it's 56dp. Attached is a video demonstrating the issue. *Steps to reproduce:*

Position an Android device in portrait.

Build and run a default Classic app project on that Android device.

Note the height of the top titlebar.

Rotate the device to landscape.

Notice the titlebar height does not shrink. _(This is the bug.)_

Keep holding the device at landscape and back out of the app.

Launch the app in landscape form.

Notice that the titlebar height is smaller upon launch.

Rotate the device to portrait.

Notice that the titlebar height has not increased. _(This is the bug.)_

Attachments

FileDateSize
bug_height_actionbar_orientation.mov2018-02-22T09:58:23.000+00009355377
BugHeightActionbar.zip2018-02-22T10:17:17.000+00003743835

Comments

  1. Guillermo Figueras 2018-03-15

    By the way, I've noticed this also happens if you use a Toolbar.
  2. Yordan Banev 2018-03-26

    [~gfigueras] This is happening because of the way Titanium is dealing with applications' configuration changes after switching orientation. I have some concerns that addressing this may introduce major problems. I will be back at it with update/information once I discuss the matter with the team.
  3. Joshua Quick 2018-10-18

    A fix for this is needed to calculate the safeAreaPadding (see [TIMOB-26427]). Especially for Android P notch support (see [TIMOB-26246]). The reason is because Google's AppCompat support library incorrectly hardcodes the *inset* height of the top ActionBar to what is defined in their XML instead of reading the actual ActionBar pixel height. This can cause issues with any native Android views which calls the Java [View.setFitsSystemWindows(boolean)](https://developer.android.com/reference/android/view/View.html#setFitsSystemWindows(boolean)) set to false because such views will be positioned wrong. This can happen with Titanium's DrawerLayouts which use a Toolbar with "extendBackground" set to true.
  4. Joshua Quick 2018-10-18

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10383
  5. Josh Longton 2018-10-25

    *FR Passed* Waiting on Jenkins to merge
  6. Keerthi Mahalingam 2018-10-25

    Verified the fix on SDK 7.5.0.v20181025085349. Actionbar works as expected. Closing
       Operating System
         Name                        = Mac OS X
         Version                     = 10.13.6
         Architecture                = 64bit
       Node.js
         Node.js Version             = 8.12.0
         npm Version                 = 6.4.1
       Titanium CLI
         CLI Version                 = 5.1.1
       Studio			      =5.1.2.201810080801
       Titanium SDK
         SDK Version                 = 7.5.0.v20181025085349
       Device                         =Samsung s5 Android 6,pixel android 9 
       Emulator			    = Samsung galaxy s6 android 6
       

JSON Source