Android五大布局之一幀布局(FrameLayout)

來源:互聯網
上載者:User

標籤: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)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.