Replies: 2 comments 2 replies
-
You can change the body background-color:
Edit: I just found a better way.
This makes the view extend under the status bar. If you have a navbar at the top you can use this style to adapt the padding:
Unfortunately double tap still changes the zoom. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I haven't figured out how to make the window cover the entire screen, such that the status bar and navigation can be transparent. But I figured out how to set the window flags and status bar/navigation colors. fn set_android_flags() {
// TODO: remove unwraps
if cfg!(target_os = "android") {
use dioxus::mobile::wry::prelude::dispatch;
dispatch(|env, activity, _webview| {
// Get the window
let window = env
.call_method(activity, "getWindow", "()Landroid/view/Window;", &[])
.unwrap()
.l()
.unwrap();
// Set window flags (for example, set keep screen on)
const FLAG_KEEP_SCREEN_ON: i32 = 128;
env.call_method(&window, "addFlags", "(I)V", &[FLAG_KEEP_SCREEN_ON.into()])
.unwrap();
// Use dark icons for status bar
let insets_controller = env
.call_method(
&window,
"getInsetsController",
"()Landroid/view/WindowInsetsController;",
&[],
)
.unwrap()
.l()
.unwrap();
if !insets_controller.is_null() {
let appearance_flag = 0x00000008; // APPEARANCE_LIGHT_STATUS_BARS
env.call_method(
&insets_controller,
"setSystemBarsAppearance",
"(II)V",
&[appearance_flag.into(), appearance_flag.into()],
)
.unwrap();
}
// Set status bar color
let color = 0xFFF2EDE3u32 as i32; // ARGB
env.call_method(&window, "setStatusBarColor", "(I)V", &[color.into()])
.unwrap();
// Set navigation bar color
env.call_method(&window, "setNavigationBarColor", "(I)V", &[color.into()])
.unwrap();
});
}
}
// use_effect(|| set_android_flags()) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
i try document::Meta { name : "theme-color" , content:"white"}
but not working.
Beta Was this translation helpful? Give feedback.
All reactions