1

My code to set tranparent status bar

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window w = getActivity().getWindow(); // in Activity's onCreate() for instance
        w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    }

after back to home my toolbar is overlapping status bar look my toolbar

please how to resolve it :( thank you for answer

Firmansyah
  • 21
  • 3

2 Answers2

0

Add this to your Theme file

<item name="android:fitsSystemWindows">true</item>

android:fitsSystemWindows

Boolean internal attribute to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this view to leave space for the system windows. Will only take effect if this view is in a non-embedded activity.

May be a boolean value, such as "true" or "false".

Amine Harbaoui
  • 1,247
  • 2
  • 17
  • 34
0

You can put android:fitsSystemWindows="true" to root view of your activity layout.

This works in my app.

Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212