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

1.层叠展示

                以下这个样例中,3个textview以层叠方式显示,通过大小和颜色我们来展示下这3个控件的层叠方式
 
                    
<?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="300dp"
android:layout_height="300dp"
android:text="游响云停工作室"
android:gravity="center"
android:background="#FFE4B5"
/> <TextView
android:id="@+id/textView1"
android:layout_width="150dp"
android:layout_height="120dp"
android:text="游响云停工作室"
android:gravity="center"
android:background="#D1EEEE"
/> <TextView
android:layout_width="100dp"
android:layout_height="50dp"
android:text="游响云停工作室"
android:gravity="center"
android:background="#EEB422"
/> </FrameLayout>

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" > <ImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@raw/pad" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品名称:Ipad Air"
android:layout_marginLeft="120dp"
android:layout_marginTop="10dp"
/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品金额:$20" android:layout_marginLeft="120dp"
android:layout_marginTop="40dp"
/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品颜色:白色"
android:layout_marginLeft="120dp"
android:layout_marginTop="70dp"
/> <TextView
android:layout_width="fill_parent"
android:layout_height="3dp"
android:text=""
android:layout_marginLeft="0dp"
android:layout_marginTop="110dp"
android:background="#D1EEEE"
/> <ImageView
android:id="@+id/imageView2"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="120dp"
android:src="@raw/pad" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品名称:Ipad Air"
android:layout_marginLeft="120dp"
android:layout_marginTop="140dp"
/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品金额:$20" android:layout_marginLeft="120dp"
android:layout_marginTop="170dp"
/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品颜色:白色"
android:layout_marginLeft="120dp"
android:layout_marginTop="200dp"
/> <TextView
android:layout_width="fill_parent"
android:layout_height="3dp"
android:text=""
android:layout_marginLeft="0dp"
android:layout_marginTop="220dp"
android:background="#D1EEEE"
/> </FrameLayout>



版权声明:本文博客原创文章。博客,未经同意,不得转载。

.Net程序猿乐Android发展---(10)框架布局FrameLayout的更多相关文章

  1. .Net程序猿乐Android发展---(1)环境结构

    对于没有接触Android人才发展,你可能会觉得Android更难以发展.接下来的一段时间,我们将了解Android开发的详细细节,主要是面对.NET程序猿,来看看.NET程序猿如何进行Android ...

  2. .Net程序猿乐Android开发---(4)注册页面布局

    接下来我们介绍的登陆页面布局,在本节中,我们看一下注册页面布局,页面布局大同小异,来一起熟悉下基本控件的使用方法. 效果图: 1.加入注冊页面 右键选中layout目录,加入注冊页面.例如以下图 点击 ...

  3. 框架布局FrameLayout

    框架布局FrameLayout 一.简介 二.代码实例 结果图: 代码: 需要注意的代码: imageView_play.setVisibility(View.INVISIBLE); <Fram ...

  4. Android 自学之帧布局 FrameLayout

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

  5. Java程序猿必知的10个调试技巧

    在本文中,作者将使用大家经常使用的的开发工具Eclipse来调试Java应用程序.但这里介绍的调试方法基本都是通用的,也适用于NetBeans IDE,我们会把重点放在运行时上面. 在開始之前,推荐大 ...

  6. Android 框架布局 FrameLayout

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

  7. Android发展的一个重要方面Makefile分析

    Android发展的一个重要方面Makefile分析 随着移动互联网的发展,移动开发也越来越吃香了.眼下最火的莫过于android.android是什么就不用说了,android自从开源以来,就受到非 ...

  8. 屌丝程序猿赚钱之道 之APP

    假设你已经通过APP赚到了钱,那么本文对你而言没有意义.倒是希望你可以给我们诸多建议. 通过制作APP或者说手机应用赚钱,相信是非常多程序猿希望做的事情.也确实有一些人通过APP赚到了钱. 对于程序猿 ...

  9. CSDN日报20170401 ——《假设你还是“程序猿”,我劝你别创业!》

    [程序人生]假设你还是"程序猿".我劝你别创业! 作者:北漂周 在IT这一行做得久了,会接触到无数让人哭笑不得的外行话. 「我们就差一个写代码的了」是当中典型的一种,之所以黑它.不 ...

随机推荐

  1. 用XAML做网页!!—框架

    原文:用XAML做网页!!-框架 上一篇中我进行了一下效果展示和概述,此篇开始将重现我此次尝试的步骤,我想大家通过阅读这些步骤,可以了解到XAML网页排版的方法. 下面就开始编写XAML,首先来定义一 ...

  2. windows phone 7 客户端和web的交互(WebBrowser的使用)

    原文:windows phone 7 客户端和web的交互(WebBrowser的使用) 前几天看到淘宝的Android客户端,有种促销的功能,当点击促销的时候连接的淘宝促销wap页面,然后点击商品后 ...

  3. 此文本文件包含的数据无法放置在一个工作表中 gb2312

    excel导入csv,csv要从unicode转为gb2312, 否则提示:此文本文件包含的数据无法放置在一个工作表中

  4. 使用 angular directive 和 json 数据 D3 随着标签 donut chart演示样本

    使用angular resource载入中priorityData.json中间json数据,结合D3绘制甜甜圈图.执行index.html其结果见于图.: priorityData.json中jso ...

  5. Xamarin 安装步骤

    原文:Xamarin 安装步骤 1.下载并解压吾乐吧软件站提供的“Mono for Android 离线包” 安装:jdk-6u45-windows-i586.exe (就算你是64位系统,也要安装i ...

  6. HDU4309-Seikimatsu Occult Tonneru(最大流)

    Seikimatsu Occult Tonneru Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 32768/32768 K (Ja ...

  7. iOS开发 编辑框被系统弹出的软键盘遮挡问题

    我们在开发注冊界面的时候,最后几个注冊条件经常easy被系统弹出的键盘遮挡,例如以下图: 能够看见,邮箱条件被遮挡掉了,怎么解决呢?我是通过UITextField的代理加计算偏移量: - (void) ...

  8. 邮箱password复位图

    blog宗旨:用图说话 辅助文字说明: 长处:用户系统完毕接口部分.界面留给业务自行设计. 缺点:邮箱发送邮件定制模板,没有完毕松耦合. 改进点:邮箱的准备发送邮件模板. 版权声明:本文博客原创文章, ...

  9. Cocos2d-x学习笔记(六) 定时器Schedule的简单应用

     Cocos2d-x中的定时器使用非常easy,共同拥有3种:schedule.scheduleUpdate和scheduleOnce.简介一下三种的差别: schedule,每隔指定时间运行某个 ...

  10. Python爬虫(一)

    花了四天的时间用python写了个简单的爬虫程序.整个过程分为两个部分:工具的安装和程序的实现 本文并没有讲程序的详细实现遇到的问题,而是对着手前一些前期的准备 第一部分(工具的安装) 开发工具的下载 ...