1. 通讯技术的介绍
- 1G通信标准: 模拟制式
- 2G通信标准: GSM/CDMA2.5G , 通信标准: GPRS
- 2.75G通信标准: EDGE
- 3G通信标准: WCDMA/CDMA2000/TD-SCDMA
- 3.5G/3.75G通信标准: HSDPA/HSDPA+/HSUDA
- 4G通信标准: TD-LTE
2. Android体系结构
3. 开发工具的疑问
- 启动Eclipse报错?
因为Eclipse是由Java代码编写的,需要JVM的支持才能启动.如果启动失败,通常是没有搭配环境变量. ADB是用来干什么的呢?
adb(Android Debug Bridge)是Android 提供的一个通用的调试工具.借助这个工具,可以管理设备模拟器的状态 ,还可以进行以下的操作:- 快速更新设备或手机模拟器中的代码,如应用或Android系统升级;
- 在设备上运行shell命令;
- 管理设备或手机模拟器上的预定端口;
- 在设备或手机模拟器上上传下载文件;
Intel x86模拟器?
Google默认提供的模拟器是基于arm处理器的, 这种模拟器运行速度慢并非常卡顿, 影响开发和学习的效率, x86模拟器采用硬件加速功能来提升运行速度, 基本和真机无异.x86模拟器使用要求?
CPU必须是Intel公司的, 并且需要是i3(包含)以上.成功安装硬件加速执行管理器: IntelHaxm.exe.
4. 常用到的命令 ?
|
|
5. Android常见布局
LinearLayout 线性布局
- orientation 属性是指定线性布局的排列方向:
horizontal 水平 vertical 垂直
- gravity属性是指定当前控件内容显示位置:
left 左边 right 右边 top 上边 bottom 底边
layout_gravity属性是指定当前控件在父元素的位置:
left 左边 right 右边 top 上边 bottom 底边
layout_weightSum属性是把线性布局中剩余空间分成N份.
layout_weight属性是指定当前控件在父元素(线性布局)中占N份.
visibility属性是控制布局是否显示:
visible 显示 invisible 不显示但占空间 gone 隐藏
- orientation 属性是指定线性布局的排列方向:
RelativeLayout 相对布局
android:layout_toRightOf 在指定控件的右边 android:layout_toLeftOf 在指定控件的左边 android:layout_above 在指定控件的上边 android:layout_below 在指定控件的下边 android:layout_alignBaseline 跟指定控件水平对齐 android:layout_alignLeft 跟指定控件左对齐 android:layout_alignRight 跟指定控件右对齐 android:layout_alignTop 跟指定控件顶部对齐 android:layout_alignBottom 跟指定控件底部对齐 android:layout_alignParentLeft 是否跟父布局左对齐 android:layout_alignParentTop 是否跟父布局顶部对齐 android:layout_alignParentRight 是否跟父布局右对齐 android:layout_alignParentBottom 是否跟父布局底部对齐 android:layout_centerVertical 在父布局中垂直居中 android:layout_centerHorizontal 在父布局中水平居中 android:layout_centerInParent 在父布局中居中
- AbsoluteLayout 绝对布局
android:layout_x 指定控件在父布局的x轴坐标 android:layout_y 指定控件在父布局的y轴坐标
FrameLayout 帧布局
- 帧布局每次添加的控件都显示在最上面,最后显示在界面上的是最后添加的一个控件.
TableLayout 表格布局
android:shrinkColumns 收缩列 android:stretchColumns 拉伸列 android:collapseColumns 隐藏列 android:layout_column 指定列(作用在列的身上) android:layout_span 合并列(作用在列的身上)
TableRow单元行里的单元格的宽度小于默认的宽度时就不起作用,其默认是fill_parent,高度可以自定义大小.
6. Android中控件的宽高单位
- px (pixels) 像素
- dip或dp (device independent pixels) 设备独立像素
- sp (scaled pixels — best for text size) 比例像素
除了上面三个显示单位,下面还有几个不太常用:
- in (inches) 英寸
- mm (millimeters) 毫米
- pt (points)点,1/72英寸
为了适应不同分辨率, 不同的像素密度, 推荐使用dip/dp, 文字使用sp.
7.练习
- 一键呼叫妻子:
|
|
|
|
小米计算器的布局:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149Activity_main.xml部分:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical" ><EditTextandroid:layout_width="fill_parent"android:layout_height="wrap_content"/><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content" ><Buttonandroid:text="C"android:textColor="#FFC928"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="DEL"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="÷"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="×"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/></LinearLayout><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content" ><Buttonandroid:text="7"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="8"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="9"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="-"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/></LinearLayout><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content" ><Buttonandroid:text="4"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="5"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="6"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="+"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/></LinearLayout><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:orientation="horizontal"><LinearLayoutandroid:orientation="vertical"android:layout_width="0dip"android:layout_weight="3"android:layout_height="wrap_content"><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:orientation="horizontal"><Buttonandroid:text="1"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="2"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/><Buttonandroid:text="3"android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/></LinearLayout><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:orientation="horizontal"><Buttonandroid:text="0"android:layout_width="0dip"android:layout_weight="2"android:layout_height="wrap_content"/><Buttonandroid:text="."android:layout_width="0dip"android:layout_weight="1"android:layout_height="wrap_content"/></LinearLayout></LinearLayout><Buttonandroid:text="="android:background="#F07A23"android:layout_width="0dip"android:layout_weight="1"android:gravity="bottom|right"android:layout_height="fill_parent"/></LinearLayout></LinearLayout>点击获取Q币:
|
|
|
|
- 点击事件四种实现方式
方式1: 布局文件声明onClick属性.
方式2: 使用匿名内部类.
方式3: 使用内部类.
方式4: 使用当前类对象, 当前类需要实现对应的接口.
8 . 总结
刚入门,没有什么可以写的.记住:每一个不曾起舞的日子,都是对生命的辜负!