Android dynamic display and hide status bar details and examples

Android dynamically shows and hides the status bar

The view class provides setsystemuivisibility and getsystemuivisibility methods, which can dynamically display or hide the status bar and obtain the current visibility of the status bar.

Setsystemuivisibility (int visibility) method can pass in the following arguments:

1. View.SYstem_ UI_ FLAG_ Visible: the status bar is displayed, and the activity is not displayed in full screen (restored to the normal condition with status). 2. View.invisible: hide the status bar, and the activity will be displayed in full screen. 3. View.SYstem_ UI_ FLAG_ Fullscreen: the activity is displayed in full screen, and the status bar is hidden and overwritten. 4. View.SYstem_ UI_ FLAG_ LAYOUT_ Fullscreen: the activity is displayed in full screen, but the status bar will not be hidden or overwritten. The status bar is still visible, and the top layout of the activity will be covered by the status. 5. View.SYstem_ UI_ FLAG_ LAYOUT_ HIDE_ Navigation: the effect is the same as that of view.system_ UI_ FLAG_ LAYOUT_ FULLSCREEN 6. View.SYstem_ UI_ LAYOUT_ Flags: the effect is the same as that of view.system_ UI_ FLAG_ LAYOUT_ FULLSCREEN 7. View.SYstem_ UI_ FLAG_ HIDE_ Navigation: hide virtual keys (navigation bar). Some phones use virtual keys instead of physical keys. 8. View.SYstem_ UI_ FLAG_ LOW_ Profile: the status bar is in low-energy display state (low profile mode), and some icons on the status bar will be hidden.

The view here refers to the root node of the activity. Get the root node, we can

Then set the properties according to your own situation.

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>