標籤:style 運行 XML pre 大小 src idt xmlns 映像
一.FrameLayout(幀布局)重點:
FrameLayout(幀布局)可以說是五大布局中最為簡單的一個布局,這個布局會預設把控制項放在螢幕上的左上方的地區,後續添加的控制項會覆蓋前一個,如果控制項的大小一樣大的話,那麼同一時刻就只能看到最上面的那個控制項
二.FrameLayout(幀布局)常用屬性:
android:foreground:設定改幀版面配置容器的前景映像
android:foregroundGravity:設定前景映像顯示的位置
三.例子:
1.首先先建立一個FrameLayout的XML檔案
代碼如下:
1 <?xml version="1.0" encoding="utf-8"?> 2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" > 5 6 <TextView 7 android:layout_width="200dp" 8 android:layout_height="200dp" 9 android:background="#FF0000" /> 10 <TextView 11 android:layout_width="150dp" 12 android:layout_height="150dp" 13 android:background="#00FFFF" /> 14 <TextView 15 android:layout_width="100dp" 16 android:layout_height="100dp" 17 android:background="#FFFF00" />18 19 </FrameLayout>
運行結果如下:
以上就是我對FrameLayout(幀布局)理解
Android五大布局之一幀布局(FrameLayout)