Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28445] Android: Add "FLAG_LAYOUT_NO_LIMITS" window constant

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2021-08-18T08:43:31.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.1.0
ComponentsAndroid
Labelsandroid, window
ReporterMichael Gangolf
AssigneeJoshua Quick
Created2020-08-15T19:59:00.000+0000
Updated2021-08-18T08:43:31.000+0000

Description

Adds the possibility to use the FLAG_LAYOUT_NO_LIMITS flag to make the statusbar completly transparent. Currently you can only hide it (fullscreen) or make it semi transparent (extendSafeArea).
var win = Ti.UI.createWindow({
	title: 'Demo App',
	backgroundColor: "#aaa",
	extendSafeArea: true,
	windowFlags: Ti.UI.Android.FLAG_LAYOUT_NO_LIMITS,
});
win.open();
!68747470733a2f2f6d6967617765622e64652f74695f6e6f4c696d6974732e6a7067.jpg|thumbnail! *Note 1:* This flag won't make the status bar transparent on Android 4.x or Android 10+. I believe you "might" have to make adjustments to the theme to make the top status bar transparent on Android 10 and higher, but Google would prefer that you make the status bar transparent via the theme instead. *Note 2:* This flag breaks the "safeAreaPadding" feature. That is, setting the "no limits" flags means the window will ignore all insets, causing "safeAreaPadding" to return all zeros. This flag also breaks the keyboard "adjustPan" feature as well. *Work-Around:* On older Titanium versions, you can use this flag "today" by using this constant's integer value as shown below.
const FLAG_LAYOUT_NO_LIMITS = 512;
const window = Ti.UI.createWindow({
	extendSafeArea: true,
	theme: "Theme.AppCompat.NoTitleBar",
	windowFlags: FLAG_LAYOUT_NO_LIMITS,
});

Attachments

FileDateSize
68747470733a2f2f6d6967617765622e64652f74695f6e6f4c696d6974732e6a7067.jpg2020-08-15T19:58:34.000+0000285901

Comments

  1. Michael Gangolf 2020-08-15

    PR: https://github.com/appcelerator/titanium_mobile/pull/11911
  2. Joshua Quick 2021-05-13

    The following PR replaces [~michael]'s PR by making this feature work via the Ti.UI.Window.windowFlags property. PR (master): https://github.com/appcelerator/titanium_mobile/pull/12809
  3. Joshua Quick 2021-08-09

    [~michael], regarding the status bar and navigation bar not being transparent on Android 10 and higher, I think it can be done by adding the following to the "-v29" version of your theme.
       <item name="android:enforceStatusBarContrast">false</item>
       <item name="android:enforceNavigationBarContrast">false</item>
       
    Alternatively, the above can be done in Java by passing false to the following methods. [Window.setStatusBarContrastEnforced()](https://developer.android.com/reference/android/view/Window#setStatusBarContrastEnforced(boolean)) [Window.setNavigationBarContrastEnforced()](https://developer.android.com/reference/android/view/Window#setNavigationBarContrastEnforced(boolean)) I ran into a similar issue when attempting to set the bottom navigation bar to completely "transparent". Android 10+ would still show it as translucent unless I did the above.

JSON Source