Document directory
Framelayout Layout
Framelayout is the simplest layout among the five la S. Elements in the framelayout layout overlap in sequence. With the overlapping layout elements of framelayout, we can hide and display layers, and place another small icon on an image.
Check the Code:
<? XML version = "1.0" encoding = "UTF-8"?> <Framelayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent"> <! -- Basemap --> <linearlayout Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: Orientation = "vertical"> <imageview Android: id = "@ + ID/imageview1" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: gravity = "center_horizontal" Android: src = "@ drawable/test1"/> </linearlayout> <! -- This view will overwrite the preceding figure --> <linearlayout Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: orientation = "vertical"> <imageview Android: Id = "@ + ID/imageview2" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_marginleft = "100dp" Android: layout_margintop = "100dp" Android: src = "@ drawable/ic_launcher"/> </linearlayout> <! -- Invisible view --> <imageview Android: Id = "@ + ID/imageview3" Android: visibility = "gone" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: src = "@ drawable/jhs_button1_h4"/> </framelayout>
Effect: the first image is at the bottom, the second image is at the top, and the third image is hidden by gone.