[TIMOB-28445] Android: Add "FLAG_LAYOUT_NO_LIMITS" window constant
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-08-18T08:43:31.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 10.1.0 |
Components | Android |
Labels | android, window |
Reporter | Michael Gangolf |
Assignee | Joshua Quick |
Created | 2020-08-15T19:59:00.000+0000 |
Updated | 2021-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
File | Date | Size |
---|---|---|
68747470733a2f2f6d6967617765622e64652f74695f6e6f4c696d6974732e6a7067.jpg | 2020-08-15T19:58:34.000+0000 | 285901 |
PR: https://github.com/appcelerator/titanium_mobile/pull/11911
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[~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.
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.