Time for action - developing a FrameLayout example
To really understand what a
FrameLayout does, and how it can be used, it's best to kick it around a bit with an example. In this example, we'll use a
FrameLayout to layer some
Button widgets on top of an
ImageView, and show-and-hide a
TextView message when one of the buttons is clicked.
For this example to work, you're going to need an image to serve as a background image. I'm going to use a photo of one of my friends. As always, place your image in the
res/drawable directory, and try to use a PNG file.
- Create a new layout resource file named
- Declare the root element as a
FrameLayoutconsuming all available space:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" ...