You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handling system bars and Edge-to-Edge enforcement (android 15+) (#3278)
* Add update_system_ui for status and navigation bar colors
Implement update_system_ui function for Android UI customization.
* Update apis.rst
* Update utils.py
* Update utils.py
* Update code quality and readbility
* Create a _global_listener to prevent garbage collection
* Update utils.py
* Set _global_listener to None in utils.py
Initialize _global_listener to None.
* Move existing logic to display_cutout
* Bug fixes
* Update docs
* Update docs for right version of the func
* Just just
Copy file name to clipboardExpand all lines: doc/source/apis.rst
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,40 @@ Working on Android
5
5
This page gives details on accessing Android APIs and managing other
6
6
interactions on Android.
7
7
8
+
Handling system bars and Edge-to-Edge enforcement
9
+
-------------------------------------------------
10
+
11
+
**Egde-to-Edge is enforced on all android apis >=35 by default i.e. Android 15 and above.**
12
+
13
+
You can control the overall layout and system bars appearance in following ways::
14
+
15
+
from android.display_cutout import update_system_ui
16
+
17
+
update_system_ui(
18
+
"#0f62fe", # status_bar_color: hex color code or rgba (tuple or list) values
19
+
[0.059, 0.384, 0.996, 1.000], # navigation_bar_color: hex color code or rgba (tuple or list) values
20
+
"Light", # icon_style: "Dark" means dark icons will be drawn, "Light" means light icons will be drawn, Literal["Dark", or "Light"]
21
+
True, # pad_status: Adds a padding to top of content_view, Will take effect on Android 15+
22
+
True, # pad_nav: Adds a padding to bottom of content_view, Will take effect on Android 15+
23
+
)
24
+
25
+
26
+
Handling Immersive Mode
27
+
~~~~~~~~~~~~~~~~~~~~~~~
28
+
29
+
Immersive mode allows your application to hide the system bars (status bar and navigation bar) for a true full-screen experience, commonly used in games or media players.
30
+
31
+
You can control the immersive mode behavior and how system bars reappear using the following way::
32
+
33
+
from android.display_cutout import set_immersive_mode
34
+
35
+
set_immersive_mode(
36
+
False, # hide_status: True explicitly targets hiding the top status bar, False leaves it visible
37
+
False, # hide_nav: True explicitly targets hiding the bottom navigation bar/gestural pill, False leaves it visible
38
+
True, # remove_contrast: True disables the default system-enforced background scrim/contrast behind the bars, ensuring complete transparency when they peek
0 commit comments