您的位置:首页 > 产品设计 > UI/UE

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>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: