The FrameLayout class anchors each of its widgets at the top-left corner of itself. This means each child widget is drawn on top of the previous one. This can be used to simulate a CardLayout from AWT by using View.setVisible to show one of the children while hiding all the others (this is effectively how TabHost works).

As FrameLayout actually paints all of its visible children, it can be used to layer the child widgets on top of each other. It produces very strange effects in some cases, while in other cases it can be amazingly useful. For example, darkening out all of the widgets except one can be achieved by using a semi-transparent View object and a FrameLayout. The inactive widgets are the first layer in the FrameLayout, a semi-transparent ...

Get Android User Interface Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.