帧布局的特点是:

1.多个组件,层叠显示

2.所占位置和大小由组件决定

示例代码:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="320dp"
android:height="320dp"
android:layout_gravity="center"
android:background="#f00"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="280dp"
android:height="280dp"
android:layout_gravity="center"
android:background="#0f0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="240dp"
android:height="240dp"
android:layout_gravity="center"
android:background="#00f"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="200dp"
android:height="200dp"
android:layout_gravity="center"
android:background="#ff0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="160dp"
android:height="160dp"
android:layout_gravity="center"
android:background="#0ff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="120dp"
android:height="120dp"
android:layout_gravity="center"
android:background="#f0f"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="80dp"
android:height="80dp"
android:layout_gravity="center"
android:background="#000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="40dp"
android:height="40dp"
android:layout_gravity="center"
android:background="#fff"/> </FrameLayout>

由于帧布局是层叠的,所以放了颜色后就能看出来,效果图如下:

Android课程---帧布局 FrameLayout的更多相关文章

  1. Android中帧布局-FrameLayout和网格布局-GridLayout

    帧布局-FrameLayout 一.概念 帧布局中,容器为每个加入其中的空间创建一个空白的区域(成为一帧).每个空间占据一帧,这些帧会按gravity属性自动对齐. 帧布局的效果是将其中的所有空间叠加 ...

  2. Android 自学之帧布局 FrameLayout

    帧布局(FrameLayout)直接继承了ViewGroup组件: 帧布局容器为每一个加入其中的组件都创建了一个空白的区域,这个区域我们称之为一帧,所有每个组件都占据一帧,这些都会根据gravity属 ...

  3. Android 基于帧布局实现一个进度条 FrameLayout+ProgressBar

    在FrameLayout中添加一个ProgressBar居中 <ProgressBar android:layout_gravity="center" android:id= ...

  4. Android——布局(线性布局linearLayout,表格布局TableLayout,帧布局FrameLayout)

    线性布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:androi ...

  5. Android布局_帧布局FrameLayout

    一.FrameLayout布局概述 在这个布局中,所有的子元素都不能被指定放置的位置,他们统统放于这块区域的左上角,并且后面的子元素直接覆盖在前面的子元素之上,将前面的子元素部分和全部遮挡  如下面的 ...

  6. Android课程---表格布局TableLayout

    特别注意:由于表格布局继承自线性布局,因此并不显示表格线 示例代码: <?xml version="1.0" encoding="utf-8"?> ...

  7. 帧布局--FrameLayout

    <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android=" ...

  8. Android精通:TableLayout布局,GridLayout网格布局,FrameLayout帧布局,AbsoluteLayout绝对布局,RelativeLayout相对布局

    在Android中提供了几个常用布局: LinearLayout线性布局 RelativeLayout相对布局 FrameLayout帧布局 AbsoluteLayout绝对布局 TableLayou ...

  9. .Net程序猿乐Android发展---(10)框架布局FrameLayout

    帧布局FrameLayout中全部的控件都在界面的左上側,后绘制的空间会覆盖之前的控件.布局内控件以层叠方式显示,用在游戏开发方面可能多些. 1.层叠展示                 以下这个样例 ...

随机推荐

  1. java&Protocol Buffers

    ps: Protocol Buffers简称PB PB 安装配置 下载 PB: 在 PB 官网,下载最新版(或者其他版本)PB,这里为了与 Java 项目中的 PB Maven 依赖版本一致,使用 P ...

  2. 04 DOM一窥

    BOM 浏览器对象模型 * window       alert(); 弹出框 confirm() 询问框 setInterval("run()",1000); 每隔1秒执行run ...

  3. Static Resources In ASP.NET Core 1.0

    静态资源包括HTML,CSS,图片和Js文件.在ASP.NET Core 1.0中,静态资源默认的所在目录是wwwroot,wwwroot可以在project.json中定义. Steps: 在www ...

  4. WebApi:路由和Action选择

      译自:http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-and-action-selection   ...

  5. Excel: 公式

    单元格内输入  = xx公式 e.g  =EXACT(C2,D2)   //比较两个单元格内的文本是否相同

  6. 01_Swift2基础之Swift简介+创建

    1.Swift 1> Swift初影响 Swift 是新一代的 iOS.OS X 和 watchOS 和 tvOS 的app开发编程语言. 中文名"雨燕",寓意为敏捷.灵巧而 ...

  7. 一个简单的C语言语法检查器的实现

    我自己的实现方法的核心过程:首先用一个非终结符代表所有要检查的程序代码,然后根据文法将这个整体的符号不断展开,以拼凑成按检查的程序的顺序排列的终结符序列,能成功说明语法正确,否则有错误. 关键词:分词 ...

  8. BZOJ3092 : [FDU2012校赛] A Famous King’s Trip

    题目等价于去掉两条边,使得剩下的图连通,且所有点度数都为偶数. 首先特判掉图一开始就不连通的情况. 求出dfs生成树,对于每条非树边随机一个权值,每条树边的权值为所有经过它的非树边权值的异或和. 那么 ...

  9. php 从myslql里导出到excel

    //导出excel 只wps可以打开public function takexcelAction(){ $name = $this->input->get_post('name'); $i ...

  10. [linux]unixODBC的安装配置说明

    什么是unixODBC: ODBC(Open Database Connect)是由Microsoft 公司于1991 年提出的一个开放的,用于访问数据库的统一接口规范. unixODBC的是为非Wi ...