Android Layout之一:FrameLayout
来源:互联网 发布:linux网页设计 软件 编辑:程序博客网 时间:2024/05/06 00:52
Android Layout有五大布局对象,分别是FrameLayout(帧布局),LinearLayout (线性布局),AbsoluteLayout(绝对布局),RelativeLayout(相对布局),TableLayout(表格布局).
FrameLayout:该布局container可以用来占有屏幕的某块区域来显示单一的对象,可以包含有多个widgets或者是container,但是所有被包含的widgets或者是container必须被固定到屏幕的左上角,并且一层覆盖一层,不能通过为一个widgets或者是container指定一个位置。Container所包含的widgets或者是container的队列是采用的堆栈的结构,最后加进来的widgets或者是container显示在最上面。所以后一个widgets或者是container将会直接覆盖在前一个widgets或者是container之上,把它们部份或全部挡住(除非后一个widgets或者是container是透明的,必须得到FrameLayout Container的允许)。
其中Main.xml 代码如下:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<TextView
android:textColor = "#0000FF"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:text = "@string/hello2"
/>
</FrameLayout>
Strings.xml代码如下:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, LayoutTestActivity!</string>
<string name="app_name">LayoutTest</string>
<string name="hello2">Hello World, I can not be LOST!</string>
</resources>
如下图,其中TextView Hello2是最后FrameLayout最后加入的,所以该TextView应该是覆盖整个屏幕的,TextView hello1被其覆盖:
- Android Layout之一:FrameLayout
- Android Layout之一:FrameLayout
- Android Layout之一:FrameLayout
- android Layout之FrameLayout
- Android Layout:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android布局详解之一:FrameLayout
- Android———Layout:Framelayout
- Android布局之一——Linear Layout
- 欢迎界面的 layout/FrameLayout设置
- Android布局理解之一:FrameLayout 内的控件如何设置位置
- ASIHTTPRequest系列(一):同步和异步请求
- ID交东西
- instance == null 与 null == instance 的区别
- 常见正则表达式
- 常用正则表达式
- Android Layout之一:FrameLayout
- c#中Marshal.Copy方法的使用
- asp.net EnableViewState禁用与注意事项
- 转:VC运行库版本不同导致链接.LIB静态库时发生重复定义问题的一个案例分析和总结
- 自动登录LINUX字符界面
- 转:VC运行库版本不同导致链接.LIB静态库时发生重复定义问题的一个案例分析和总结
- Android架构
- makefile规则学习一
- ODI工作资料库底层数据结构研究(一)