Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve StatusBar effect like in Medium or Telegram X apps?

Medium: before scroll and after scrolling

Telegram X: normal if you have internet connection and otherwise

As you can see icons like Wi-Fi and others disappear; only currenct time and battery icon remain, but with 50% opacity.

Also, this effect is applied using smooth fade in and fade out animation.

EDIT: For everyone who need some info about this issue check this answer. https://stackoverflow.com/a/49182417/9342948

like image 392
Dmitry Kozyrenko Avatar asked Nov 07 '22 10:11

Dmitry Kozyrenko


1 Answers

After searching for a while I found this. It automatically applies fadein and fadeout animation.

View decorView = getActivity().getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
like image 76
niranjan kurambhatti Avatar answered Nov 14 '22 22:11

niranjan kurambhatti