FrameLayout:帧布局,可以显示图片的动画效果

前景图像:
永远处于帧布局最顶的,直接面对用户的图像,,就是不会被覆盖的图片

常用属性:

android:foreground:设置该帧布局容器的前景图像

android:foregroundGravity:设置前景图像显示的位置

2.实例演示

1)最简单的例子

运行效果图:

实现代码如下:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:foreground="@drawable/logo"
android:foregroundGravity="right|bottom"> <TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#FF6143" />
<TextView
android:layout_width="150dp"
android:layout_height="150dp"
android:background="#7BFE00" />
<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#FFFF00" /> </FrameLayout>

代码解析: 很简单,三个TextView设置不同大小与背景色,依次覆盖,接着右下角的是前景图像,通过 android:foreground="@drawable/logo"设置前景图像的图片, android:foregroundGravity="right|bottom"设置前景图像的位置在右下角

最新文章

  1. C语言 第八章 函数、指针与宏
  2. 火狐----此地址使用了一个通常用于网络浏览以外的端口。出于安全原因,Firefox 取消了该请求。
  3. 解决win10装不了wifi驱动
  4. Nginx和PHP-FPM的启动/重启脚本 [转发]
  5. jQuery实现登录提示
  6. npm命令大全
  7. it小小鸟心得
  8. struts2拦截器源码分析
  9. Dapper事务操作
  10. Angular - - ngInclude、ngTransclude
  11. 在Signalr的Hub中写方法实现与安卓的数据交互
  12. React+webpack开发环境的搭建
  13. Maven快速使用阿里云的代理maven仓库
  14. Ubuntu 16.04 nvidia-smi报错(重装Nvidia驱动)
  15. Ubuntu下找不到ttyUSB*问题解决
  16. django2.0再写一行代码
  17. 分享一个小设置-项目启动时服务器指向本地IIS
  18. Azure系列2.1.7 —— BlobRequestOptions
  19. Python关键点笔记之使用 pyenv 管理多个 Python 版本依赖环境
  20. C/C++的内存泄漏检测工具Valgrind memcheck的使用经历

热门文章

  1. ryu 下发流表配置
  2. django系列8.3--django中间件实现登录验证(1)
  3. spring-mybatis源码追踪
  4. [AS3.0] 解决Number类型计算不精确问题
  5. Unicode字符串索引
  6. Linux(Ubuntu)新建用户只有一个$问题
  7. 总结day25 ---- udp 初识, 和tcp 进阶
  8. P4915 帕秋莉的魔导书
  9. (RaspBerry Pi) Python GPIO 基本操作
  10. js 弹性导航