欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android布局之FrameLayout幀布局

 更新時(shí)間:2015年12月31日 10:31:20   作者:會(huì)飛的一只狼  
這篇文章主要介紹了Android布局之FrameLayout幀布局的相關(guān)資料,需要的朋友可以參考下

前言

作為android六大布局中最為簡(jiǎn)單的布局之一,該布局直接在屏幕上開辟出了一塊空白區(qū)域,

當(dāng)我們往里面添加組件的時(shí)候,所有的組件都會(huì)放置于這塊區(qū)域的左上角;

幀布局的大小由子控件中最大的子控件決定,如果都組件都一樣大的話,同一時(shí)刻就只能能看到最上面的那個(gè)組件了!

當(dāng)然我們也可以為組件添加layout_gravity屬性,從而制定組件的對(duì)其方式

幀布局在游戲開發(fā)方面用的比較多,等下后面會(huì)給大家演示一下比較有意思的兩個(gè)實(shí)例

(-)幀布局簡(jiǎn)介

幀布局容器為每個(gè)加入的其中的組件創(chuàng)建一個(gè)空白的區(qū)域稱為一幀每個(gè)子組件占據(jù)一幀,這些幀都會(huì)根據(jù)gravity的屬性執(zhí)行自動(dòng)對(duì)齊

(二)常用屬性:

android:foreground:設(shè)置該幀布局容器的前景圖像

android:foregroundGravity:設(shè)置前景圖像顯示的位置

(三)使用

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent">
 <FrameLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  >
  <TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_gravity="center"
   android:width="300dp"
   android:height="300dp"
   android:background="#f00"/>
  <TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_gravity="center"
   android:width="200dp"
   android:height="200dp"
   android:background="#0f0"/>
  <TextView
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_gravity="center"
   android:width="100dp"
   android:height="100dp"
   android:background="#00f"/>
 </FrameLayout>
</LinearLayout>

以上內(nèi)容給大家介紹了Android布局之FrameLayout幀布局,希望大家喜歡。

相關(guān)文章

最新評(píng)論