简体   繁体   中英

How to hide status bar on click of listview item in fragment programmatically?

I am hiding the status bar on click of ListView item in getView method.But when I am hiding status bar then getview method called .It should not be called. Here is my code :-

getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

This line I have added. How to prevent from calling getview method when hide status bar.

Thanks in advance.

Once the status bar is hidden your UI needs to be redrawn, as there's more space now. It's perfectly normal that you get calls to getView.

You can either hide the status bar before drawing the list, or clean up your getView method from whatever problems that occur if they need to be redrawn.

Note: To hide the status bar for android 4.1+ you can use:

View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);

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