Skip to main content

Posts

Showing posts with the label Compose Utility

Jetpack compose: How to hide system bars

Jetpack Compose - Hiding System Bars This code demonstrates how to hide the system bars (status bar and navigation bar) in a Jetpack Compose application. It achieves this by leveraging the accompanist-systemuicontroller library. Code Breakdown: Imports: The code imports necessary classes for building the UI and accessing the system UI controller. MainActivity: This is the main activity class that extends ComponentActivity . It sets the content of the activity using setContent during onCreate . GetScaffold: This composable function builds the main layout structure using Scaffold . It defines three sections: topBar : This defines the top bar using TopAppBar with a title, background color, and content color. content : This section displays the main content of the app, represented by the MainContent composable. backgroundColor : This sets the background color for the entire scaffold. MainContent: This composable retrieves the SystemUiController using rememberSystemUi...