14

What is ScrimInsetsFrameLayout?

I am working in Navigation Drawer with ToolBar,In most of the tutorial they using ScrimInsetsFrameLayout, For what purpose it use can any one explain breif?

appukrb
  • 1,507
  • 4
  • 24
  • 53

1 Answers1

15

It is part of a set of classes that appeared first (I think) in Googles iosched. Google have made the source code available on GitHub here.

Its worth downloading and taking a look at it.

ScrimInsetsFrameLayout has the comment - A layout that draws something in the insets passed to {@link #fitSystemWindows(Rect)}, i.e. the area above UI chrome (status and navigation bars, overlay action bars).

If you download compile and install the App you can see the DrawerLayout is above the ToolBar and to the edges of the screen. ScrimInsetsFrameLayout is what allows you to do this.

You can also see that ScrimInsetsFrameLayout extends FrameLayout which in turn extends ViewGroup and View. View has the reference to setFitsSystemWindows which allows you to set android:fitsSystemWindows="true" in the xml file where you use ScrimInsetsFrameLayout.

You can do DrawerLayout without it, but the look is very clean and matches Googles objectives for Material Design.

Longmang
  • 1,663
  • 1
  • 13
  • 12