简体   繁体   中英

How to make status bar and bottom navigation transparent in android using java in android studio?

I want to make my Activity as full screen with transparent status bar and transparent bottom navigation bar.

I used some code but there is some issues in the screenshot below. These is some space below the status bar and also above the bottom navigation. How to resolve that?. Please anyone help.

在此处输入图像描述

You can try two approaches:

Follow this documentation: https://developer.android.com/develop/ui/views/layout/edge-to-edge(Don't forget to treat the insets of bottom for navigation bar and top padding for status bar to avoid view overflow)

Or just follow my example (that's work for me):

WindowCompat.setDecorFitsSystemWindows(window, false)

Do this in the activity, to fit your screen in the screen boundary. And after that you may need apply insets to bottom (for navigation bar) and to top (for status bar).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM