Pr.Pg Next Pg

More with XML tutorials


Frame Layout

  • FrameLayout is designed to block out an area on the screen to display a single item.

  • Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other.

  • You can, however, add multiple children to a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity attribute.

  • Child views are drawn in a stack, with the most recently added child on top.

  • The size of the FrameLayout is the size of its largest child (plus padding), visible or not (if the FrameLayout's parent permits). Views that are GONE are used for sizing only if setConsiderGoneChildrenWhenMeasuring() is set to true.


Siding Drawer

  • SlidingDrawer hides content out of the screen and allows the user to drag a handle to bring the content on screen.

  • SlidingDrawer can be used vertically or horizontally.

  • A special widget composed of two children views: the handle, that the users drags, and the content, attached to the handle and dragged with it.

  • SlidingDrawer should be used as an overlay inside layouts.

  • This means SlidingDrawer should only be used inside of a FrameLayout or a RelativeLayout for instance.

  • The size of the SlidingDrawer defines how much space the content will occupy once slid out so SlidingDrawer should usually use match_parent for both its dimensions. Inside an XML layout, SlidingDrawer must define the id of the handle and of the content:

  • Sliding Drawer has been deprecated for API 17.


Pr.Pg border                                              Next Pg