`

Android 用户界面(User Interface)

阅读更多
View 基类:
视图对象在屏幕特定矩形区域处理自己的尺寸,布局,绘图,焦点切换,滚动,按键/手势交互.也
接收用户交互事件.

View 是 Widget基类,为之提供服务.
ViewGroup 是 Layout 基类,为之提供服务.

视图体系:
ViewGroup
   |
ViewGroup
   |    |
View    ViewGroup
            |
            View



布局:
声明式布局 main.xml

Widgets:
UI组件

UI 事件:
1.定义一个事件监听器,并使用视图注册
2.重写视图回调方法


Menus:
MENU key
菜单键
定义
onCreateOptionsMenu()
onCreateContextMenu()
回调方法声明菜单项.不需要注册事件监听器在菜单中.

声明式菜单项.


Adapters:
适配器

Styles and Themes:
样式:View
主题:Activity或应用

声明式布局:
使用XML文件来描述布局,避免硬编码.提高布局的灵活性.同时表现与行为分离.

创建菜单:
可选菜单:包括图标菜单和扩展菜单.图标菜单最多支持6个菜单项.不支持单选,多选框.
上下文菜单:
子菜单:作文可选菜单和上下文菜单的子菜单,但不能再嵌套子菜单.

在XML中定义菜单
快捷键


Creating Dialogs:
AlertDialog
ProgressDialog
DatePickerDialog
TimePickerDialog

处理 UI Events:
onClick()
From View.OnClickListener.
This is called when the user either touches the item (when in touch mode), or focuses upon the item with the navigation-keys or trackball and presses the suitable "enter" key or presses down on the trackball.

onLongClick()
From View.OnLongClickListener.
This is called when the user either touches and holds the item (when in touch mode), or focuses upon the item with the navigation-keys or trackball and presses and holds the suitable "enter" key or presses and holds down on the trackball (for one second).

onFocusChange()
From View.OnFocusChangeListener.
This is called when the user navigates onto or away from the item, using the navigation-keys or trackball.

onKey()
From View.OnKeyListener.
This is called when the user is focused on the item and presses or releases a key on the device.

onTouch()
From View.OnTouchListener.
This is called when the user performs an action qualified as a touch event, including a press, a release, or any movement gesture on the screen (within the bounds of the item).

onCreateContextMenu()
From View.OnCreateContextMenuListener.
This is called when a Context Menu is being built (as the result of a sustained "long click"). See the discussion on context menus in Creating Menus for more information.

事件处理器:

onKeyDown(int, KeyEvent) - 按键.
onKeyUp(int, KeyEvent) - 按键.
onTrackballEvent(MotionEvent) - Called when a trackball motion event occurs.
onTouchEvent(MotionEvent) - 触摸屏幕
onFocusChanged(boolean, int, Rect) - 获取和失去焦点

用户通知:
Toast Notification: 弹出一个窗口
Status Bar Notification: 状态条
Dialog Notification: 对话框


应用样式和主题:
styles.xml

自定义UI组件:

AdapterView 绑定数据

常用布局对象:
FrameLayout: 帧布局,所有子对象都定位在左上角,并且重叠放置.
LinearLayout: 线性布局,所有子对象从左到右依次排列或从上到下依次排列.不换行/列.
TableLayout: 表格布局,简单表格行列式布局.
RelativeLayout: 相对布局,相对元素布局.


视图渲染:
视图渲染是从视图树根结点开始.分2个过程.第一个过程计算大小measure,第二个过程确定布局layout.
视图渲染从根结点开始广度优先draw().


分享到:
评论

相关推荐

    Android.User.Interface.Development.Beginners,超清晰android界面开发电子书(老外写的)

    《Android User Interface Development for Beginners》是一本专为初学者设计的Android界面开发指南,由外籍作者撰写,旨在帮助读者深入理解并掌握构建Android用户界面的关键技术。这本书详细讲解了如何利用Android ...

    Android User Interface Development

    - **定义**:Android用户界面(User Interface, UI)是指在Android设备上显示给用户的图形界面,包括各种控件、布局以及交互方式等。 - **目的**:提供一种直观、友好的方式让用户与应用程序进行交互。 - **关键组件**...

    Android_User_Interface.rar_android_android for Qt_qt android

    在Android平台上,用户界面(User Interface,UI)的设计与实现是开发者关注的重要方面。这篇教程“Android User Interface”旨在帮助初级学者理解如何在Android环境中创建和优化用户界面,特别是结合Qt进行跨平台...

    Android.User.Interface.Development.Beginners.Guide.Feb.2011.pdf

    ### Android用户界面开发初学者指南知识点解析 #### 一、书籍基本信息 - **书名**:《Android 用户界面开发初学者指南》 - **作者**:Jason Morris - **出版日期**:2011年2月 - **出版社**:Packt Publishing - *...

    [书籍]安卓用户界面开发入门-Android User Interface Development

    1. 安卓用户界面开发(Android User Interface Development):安卓用户界面开发是安卓应用开发的一个重要组成部分,专注于创建和优化用户与应用交互的界面和体验。这包括设计、布局、交互逻辑和视觉元素的实现。...

    android-user-interface-development.rar_android

    Android用户界面开发主要基于Android SDK,其中包含了各种工具和API,用于创建引人入胜且功能丰富的用户交互。首先,我们需要了解Android的布局(Layouts),它们决定了屏幕上元素的排列方式。常见的布局类型包括...

    Android User Interface Development Beginner【高清】

    标题中的“Android User Interface Development Beginner”意指本书为初学者入门Android用户界面开发所编写。Android是Google开发的一个基于Linux内核的开源操作系统,广泛用于智能手机和平板电脑等移动设备。用户...

    高清彩版 Android User Interface Design Implementing Material Design for Developers

    1. Android用户界面设计: 本书专注于Android平台的用户界面设计,特别是Material Design(材质设计)的实现方法,这是一套由Google设计和推广的设计语言,旨在为用户提供更直观、更丰富的交互体验。 2. 开发者视角:...

    android 用户界面UI详解

    在Android开发中,用户界面UI(User Interface)是与用户交互的关键部分,它决定了应用程序的外观和用户体验。本文将深入探讨Android UI的构建,包括布局(Layouts)、LayoutParams及其相关概念。 首先,Android...

    Android 用户界面程序简单例子

    本文将通过一个简单的Android用户界面示例来讲解如何构建基本的UI元素,并了解它们的基本属性及布局方式。 #### 二、代码分析 本示例展示了一个简单的Android应用界面,主要包含了两个输入框(用于输入姓名和年龄...

    Android User Interface Development Beginner's Guide(书+源码)

    《Android User Interface Development Beginner's Guide》是一本专为初学者设计的指南,旨在帮助读者掌握在Android平台上构建用户界面的基本技能。这本书结合了理论知识与实际的源代码示例,使得学习过程更具实践性...

    浙大讲义:Android用户界面.rar

    这份"浙大讲义:Android用户界面.rar"压缩包包含了一份浙江大学关于Android UI设计的课程资料,主要涵盖了以下几个方面: 1. **布局(Layout)**:在Android中,布局是组织和定位UI元素的方式。常见的布局有...

    user-interface-samples-master.zip

    在Android应用开发中,用户界面(User Interface, UI)的设计与实现是至关重要的,它直接影响到用户的使用体验和应用程序的受欢迎程度。本压缩包“user-interface-samples-master.zip”提供了丰富的Java编程语言编写...

    18 The Fundamentals of User Interface (UI) Design for Mobile

    用户界面(UI)设计是移动应用开发中的关键环节,它直接影响到用户体验和应用程序的可用性。在本专题“18 The Fundamentals of User Interface (UI) Design for Mobile”中,我们将深入探讨移动UI设计的基本原则和...

    user-interface-samples.zip

    "user-interface-samples.zip"这个压缩包提供了关于Android用户界面,特别是屏幕键盘(Input Method Editor, IME)管理的实例代码,帮助开发者更好地理解和实现屏幕键盘的显示与隐藏控制。 首先,我们来理解IME的...

Global site tag (gtag.js) - Google Analytics