UI基本组件和几大布局
2014-09-29 15:49
267 查看
所有界面组件的基类(包括ViewGroup类)。常用属性:
属性名 描述
android:alpha 透明度:0-1
android:background 背景颜色/背景图像。"@null"表示透明
android:clickable 是否可以激发点击事件:true | false
android:focusable 是否可以获得焦点: true | false
android:id 组件的唯一标识。格式为:"@+id/name"
android:layout_height 组件在布局容器中的布局高度。任何组件都必须要的。可选值为:
"wrap_content": 使组件根据内容来自适应
"match_parent"或"fill_parent":占满该控件所在容器的所有空间尺寸值: 125dp。
android:layout_width 组件在布局容器中的布局宽度。任何组件都必须要的
android:layout_gravity 组件在布局容器中的对齐方式。默认是left|top (水平|垂直)
android:gravity 组件内部的内容的对齐方式。
android:layout_margin 组件在布局容器中的外边距。
android:padding 上下左右的内边距
android:visibility 是否可见:visible(可见)默认值、invisible(不可见占用空间)、gone(不可见不占用空间)
UI基本组件主要有
FrameLayout—帧布局
•所有添加到这个布局中的视图都以层叠的方式显示。第一个添加的组
件放到最底层,最后添加的组件显示在最上面,把下一层组件部份或
全部覆盖。
•FrameLayout的大小以子组件(可见)最大项的大小来计算
•保证所有子组件正确呈现:android:measureAllChildren=“true”
<?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="match_parent"
android:layout_height="wrap_content"
android:text="@string/framelayout_title"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#536D86"
android:background="@drawable/bar_bg"
android:gravity="center"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_edit"
android:contentDescription="@string/blank"
android:layout_gravity="left|top"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_refresh"
android:contentDescription="@string/blank"
android:layout_gravity="right|top"/>
</FrameLayout>
属性名 描述
android:alpha 透明度:0-1
android:background 背景颜色/背景图像。"@null"表示透明
android:clickable 是否可以激发点击事件:true | false
android:focusable 是否可以获得焦点: true | false
android:id 组件的唯一标识。格式为:"@+id/name"
android:layout_height 组件在布局容器中的布局高度。任何组件都必须要的。可选值为:
"wrap_content": 使组件根据内容来自适应
"match_parent"或"fill_parent":占满该控件所在容器的所有空间尺寸值: 125dp。
android:layout_width 组件在布局容器中的布局宽度。任何组件都必须要的
android:layout_gravity 组件在布局容器中的对齐方式。默认是left|top (水平|垂直)
android:gravity 组件内部的内容的对齐方式。
android:layout_margin 组件在布局容器中的外边距。
android:padding 上下左右的内边距
android:visibility 是否可见:visible(可见)默认值、invisible(不可见占用空间)、gone(不可见不占用空间)
UI基本组件主要有
FrameLayout—帧布局
•所有添加到这个布局中的视图都以层叠的方式显示。第一个添加的组
件放到最底层,最后添加的组件显示在最上面,把下一层组件部份或
全部覆盖。
•FrameLayout的大小以子组件(可见)最大项的大小来计算
•保证所有子组件正确呈现:android:measureAllChildren=“true”
<?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="match_parent"
android:layout_height="wrap_content"
android:text="@string/framelayout_title"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#536D86"
android:background="@drawable/bar_bg"
android:gravity="center"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_edit"
android:contentDescription="@string/blank"
android:layout_gravity="left|top"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_refresh"
android:contentDescription="@string/blank"
android:layout_gravity="right|top"/>
</FrameLayout>
相关文章推荐
- Android UI基本测验:线性布局
- Android UI基本测验“.NET研究”:线性布局
- Android开发学习之路--UI之基本布局
- jQuery组件easyui基本布局实现代码
- 布局+基本UI
- 基本UI部件、布局
- Android开发1:基本UI界面设计——布局和组件
- 【IOS】基本UI布局
- 常用布局及基本 UI 控件(2)
- 从零开始,搭建博客系统MVC5+EF6搭建框架(4)上,前后台页面布局页面实现,介绍使用的UI框架以及JS组件
- 安卓个人学习------UI布局组件学习与整理简析
- 【keep thinking】第七期 android UI 基本布局
- 安卓重要组件#5-ListView控件一些基本属性,添加头尾布局和小结
- Android开发学习之路--UI之基本布局
- 《Apple Watch 开发》UI 布局、大小等基本控制
- Android UI基本测验:线性布局
- android面试题目大全<第一部分>,android基本的UI控件和布局文件知识
- 枫叶天空Cocos2d-x3.0系列教程三 ui教程2 布局组件
- 详解Android应用中使用TabHost组件进行布局的基本方法
- Android 基本的UI布局