Android 基础(三)、User Interface
来源:互联网 发布:手机知乎提问没人回答 编辑:程序博客网 时间:2024/05/16 01:59
Activitys
shemselves are made up of sub-components called views
1、View是什么?
Views是用户能看见并且交互的部分。
Views处理layout(布局),提供按钮,允许在屏幕上绘图等等
Activity是symphony(交响乐),View就是音乐家
View需要乐器(instruments),Views和其他components充分利用colors,strings,styles,graphics,and the like
(这些数据都会被complie成binary form)
2、R.java的作用是在Android binary references和source resources之间搭建桥梁
3、activitys,views,resources之间关系如下
4、自己的activity所做的重要事情
- it gives our application a “context,” because Activity itself extends android.app.ApplicationContext ;
- it brings the Android life-cycle methods into play;
- it gives the framework a hook to start and run your application;
- it provides a container into which View elements can be placed.
5、onCreate中setContentView方法的作用
将XML布局view文件联系起来。此外可以使用代码配置View
XML是静态的,作为View tree的一部分
6、adapter(适配器)是做什么的?
adapter来链接(Link)包含数据的Views。
adapter返回collections中的每个item(以View的形式)
ArrayAdapter
在Context(this)上非常流行,View的element定义在XML resource file上,使用array数组来表示数据(也define在XML中)
Spinner的使用
ArrayAdapter<String> cuisines = new ArrayAdapter<String>(this, R.layout.spinner_view, this.getResources().getStringArray(R.array.cuisines));//适配器对象初始化cuisines.setDropDownViewResource(R.layout.spinner_view_dropdown);//设置下拉的View样式this.cuisine.setAdapter(cuisines); //设置适配器
7、onCreateOptionsMenu创建menu items的样式
menu.add能增加一个item
setIcon设置item的样子
onMenuItemSelected设置menu item的监听器
0 0
- Android 基础(三)、User Interface
- Android应用基础——User Interface
- Android - User Interface
- Android Dev Guide -> User Interface
- Android Dev Guide -> User Interface
- Android API Guides---User Interface
- [Android SDK 翻译] User Interface Guidelines
- Android 开发指南 翻译 User Interface -- Dialogs
- Android 用户界面(User Interface)概要
- Android 用户界面(User Interface)概要
- Android API Guide 之 User Interface笔记
- Android API Guide 之 User Interface笔记
- Android API Guides——User Interface
- Android - UI(User Interface)的基本设计
- Creating Android Applications with HTML User Interface
- Android user interface testing with Robotium - Tutorial
- a simple android user interface in java
- Android学习二(user Interface笔记)
- 利用AppInventor实现注册功能(完整版)
- Apple Pay发展与安全
- java 图片缩略图的两种方法
- c中断函数
- Android—ToggleButton、Switch和RatingBar使用
- Android 基础(三)、User Interface
- 利用AppInventor实现登录功能(完整版)
- NAT 四种地址解释
- 基于ThinkPHP3的微信平台开发_1
- Hibernate HQL以及相关方法
- 二叉排序树
- Android中的MediaMetadataRetriever类取得媒体文件信息
- ClipDrawable的使用
- 后缀表达式(逆波兰表达式),并求值(可求浮点、负数与大于10的数),C++实现