Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is ScrimInsetsFrameLayout?

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?

like image 371
appukrb Avatar asked Mar 02 '15 07:03

appukrb


1 Answers

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.

like image 174
Longmang Avatar answered Nov 06 '22 21:11

Longmang