智能家居:可以联网可以用指令操作可以返回状态。智能微波炉智能眼镜智能手表。

Android作者Andy Rubin,2007年正式由谷歌推广,开源的。

安卓体系结构和开发一个闹钟的调用结构图:

安卓和ios都是基于linux内核开发的。

开发工具:

Eclips+ADT,

Intel模拟器加速器虚拟化cpu提高模拟器的速度,可以提高十多倍。

  1. System.out.println("hahahah,我被点击了.");打印到logCat控制台。
  2. #Android体系结构
  3. * 底层Linux操作系统
  4. * library c/c++的函数库
  5. * 应用程序框架层 java提供的函数库
  6. * 应用程序
  7.  
  8. #jvm和dvm的区别
  9. * 版权问题
  10.  
  11. * 效率问题
  12.  
  13. #下载Android开发的sdk
  14. * 什么是sdk
  15. > standard develop kits 标准开发工具集
  16.  
  17. 下载选择32位或者64位的版本
  18. 直接解压下载下来的zip
  19.  
  20. #Android sdk的目录结构
  21. * eclipse 开发工具ide 订制版本的eclipse
  22. * sdk 开发工具集合
  23. * SDK Manager.exe sdk管理器,提供sdk的更新
  24.  
  25. #sdk文件夹的目录结构(打开SDK Manager.exe看到的)
  26. * Extras 额外的工具
  27. * Android support library 向下兼容提供的函数库
  28. * Google usb driver 真实手机的驱动(只有谷歌的亲儿子才可用 nexus s)
  29. * intel HAM intel的硬件加速(只有是intel的处理器,adm处理器不可用)
  30.  
  31. * 模拟器要想在电脑上运行需要有系统的镜像
  32. * arm system image (arm系统平板,在电脑上模拟运行速度比较慢)
  33. * x86 system image (x86电脑处理器,在电脑上模拟运行速度比较快)
  34.  
  35. * doc 离线文档(包含全部的api的说明)
  36.  
  37. * platforms 不同版本sdk的开发android.jar
  38.  
  39. * platform-tools 平台工具
  40. * adb.exe Android debug bridge(安卓开发调试桥)
  41. * dx.bat 把.class的字节码转化成.dex的字节码
  42.  
  43. * samples 开发用的示例代码
  44.  
  45. * sources sdk的全套源码
  46.  
  47. * system-images 系统镜像
  48.  
  49. * tools 模拟器的应用程序就存放在这个文件夹里面
  50.  
  51. ##强烈推荐使用4.1.2版本的模拟器.最稳定.
  52. ##千万不要使用4.2版本的模拟器,bug非常多
  53.  
  54. ##常见分辨率
  55. * VGA 640x480
  56. * HVGA 480x320
  57. * QVGA 320x240
  58. * WVGA 800x480
  59. * FWVGA 854x480
  60.  
  61. ##模拟器名称
  62. *5554 端口号 一个模拟器占用两个端口号
  63.  
  64. ##DDMS
  65. * dalvik debug manager system
  66.  
  67. ##ADT
  68. >Android Developer Tools 安卓开发工具集(eclipse的一个插件)
  69. >21.1.0.v20130206 不要升级adt的版本
  70. >会帮着我们自动创建Android的工程结构,帮我们编译应用程序-->生成apk--->部署手机-->运行
  71.  
  72. ##Android工程磁盘的目录结构
  73. * .settings eclipse创建的文件夹 记录工程的配置信息
  74. * assets 资产目录 打包一些文件到应用程序里面(数据库文件,网页文件,配置文件,图片)
  75. * bin eclipse编译的二进制文件,把java-->class--->dex-->res打包-->.apkapkzip文件,可以把后缀名改为zip后用解压缩软件打开。
  76. * gen 自动生成的代码
  77. * libs android-support-v4.jar 安卓的支持jar
  78. * res 应用程序的资源目录 图标 文本 颜色资源
  79. * drawable 存放应用程序的图片资源
  80. * layout 存放应用程序的布局文件 xml文件
  81. *
  82. * src 我们编写的java代码
  83. * .classpath eclipse配置文件
  84. * .project eclipse配置文件
  85. * manifest.xml 非常重要是应用程序的清单文件 配置应用程序的版本号,图标,名称
  86. * project.properties 工程的配置文件
  87.  
  88. ##Android应用程序开发的步骤
  89. 1. 创建工程,配置应用程序工程名称,包名,图标.
  90. 2. 编写应用程序的ui界面, res-->layout--->main_activity.xml
  91. > 布局都是xml文件编写的,支持图形化的拖拽
  92. 3. java代码.在src目录下 MainActivity.java
  93.  
  94. @Override
  95. protected void onCreate(Bundle savedInstanceState) {
  96. super.onCreate(savedInstanceState);
  97. //设置应用程序显示的界面
  98. setContentView(R.layout.activity_main);
  99. //TODO:查找我们关心的控件,实现控件的点击事件
  100. }
  101. 4. 必须给关心的控件设置id. 这个id会在R.java文件里面生成一个引用
  102. 5. java代码 findViewById(R.id.xxxx);
  103. 6. 设置控件的点击事件
  104.  
  105. bt_click.setOnClickListener(new MyButtonListener());
  106.  
  107. 7. 打印土司
  108.  
  109. Toast.makeText(MainActivity.this, "hahahah,我被点击了.", Toast.LENGTH_SHORT).show();
  110.  
  111. ##应用程序编译安装的过程(磁盘里面查看).
  112. 一. 把所有的.java文件编译成.class文件 bin/class文件夹下面
  113. > jdk javac.exe
  114.  
  115. 二. 把所有的.class字节码文件打包合成一个文件 classes.dex
  116.  
  117. > sdk中的dx.bat文件 把.class -->.dex
  118.  
  119. 三. 根据资源的id,生成一个资源文件resources.ap_ 保存全部的资源文件的信息
  120.  
  121. 四. 把.dex文件,res目录下的资源文件,resources.ap_的引用, asset目录下的文件
  122. 合成在一起打成一个apk的压缩包
  123.  
  124. >使用的是 aapt.exe
  125.  
  126. 五. adb.exe 负责把生成好的apk文件上传安装到手机里面.
  127. > Android debug bridge 安卓调试桥,负责上传安装apk
  128.  
  129. ##常见的adb命令

ctrl+shift+鼠标右键:快速打开命令行窗口。
路径加入环境变量是在path里面添加adb.exe的路径。

  1. * 安装一个应用程序
  2. > adb install xxx.apk
  3.  
  4. * 卸载一个应用程序
  5. > adb uninstall com.itheima.clickme<包名>
  6.  
  7. * 进入到手机终端里面
  8. > adb shell
  9. > 进入手机终端之后就可以执行Linux命令 kill 杀死一个进程 ps 列出来进程 ls 列出来文件
  10.  
  11. * 杀死adb的调试桥
  12. >adb kill-server
  13. >adb的调试桥不稳定,经常掉线,如果掉线了,执行adb kill-server把调试桥杀死
  14.  
  15. * 启动adb的调试桥
  16. >adb start-server
  17.  
  18. * 查看连接在电脑上的设备
  19. >adb devices
  20. >adb start-server这个方法比较笨,如果一次启动不成功,就不启动了.通常使用adb devices来代替adb start-server
  21.  
  22. * 指定设备执行adb指令
  23. >adb -s emulator-5556 install xxx.apk
  24.  
  25. ##URI && URL
  26. * URL 统一资源定位符(网址,ftp,rtsp)
  27. > http://www.baidu.com
  28. > http://www.itheima.com
  29.  
  30. * URI 统一资源标识符(范围更加广泛)
  31. > tel://110
  32. > content://
  33. ##权限模型的目的,例如拨打电话权限:
  34. <uses-permission android:name="android.permission.CALL_PHONE"/>
  35. * 给用户一个提醒,让用户知道你安装的软件需要干什么操作.
  36. * 只有敏感操作才需要申请权限(钱,设备安全,隐私)
  37. * 避免潜在法律诉讼
  38. ##点击事件的四种写法
  39. * 内部类
  40. * 匿名内部类
  41. * activity实现onclickListener接口
  42. * 在布局xml文件里面绑定点击事件
  43. ##常见的布局
  44. * LinearLayout 线性布局
  45. > 线性布局的朝向 vertical|horizontal
  46. > 线性布局的权重 weight 0dip一起使用
  47. * RelativeLayout 相对布局 都是按照相对位置排列的
  48. * FrameLayout 帧布局
  49. > 布局层层叠加覆盖的
  50. > DIV

拨打电话:

  1. private class MyButtonListener implements OnClickListener{
  2. @Override
  3. public void onClick(View v) {
  4. //2.当用户点击按钮的时候 获取里面的电话号码
  5. String phone = et_phone.getText().toString().trim();
  6. if("".equals(phone)){//LENGTH_SHORT时长
  7. Toast.makeText(MainActivity.this, "电话号码不能为空", Toast.LENGTH_SHORT).show();
  8. }else{
  9. //拨打电话....调用系统的应用程序让系统帮我们拨打电话.
  10. //机器打孔-->汇编语言(要对处理器非常了解)-->c语言-->c++(有内存泄漏问题) -->java(c+++)--->c#(++++)---> 第五代编程语言(自然语言)
  11. //1.创建一个意图对象. 打(action) 贱人(data) 泡(action)红茶(data)
  12. Intent intent = new Intent();
  13. //dail是启动拨号界面, call直接拨打号码
  14. intent.setAction(Intent.ACTION_CALL);//设置动作action, 拨打电话
  15. //3.指定动作的数据
  16. intent.setData(Uri.parse("tel://"+phone));//parse将字符串转换为Uri
  17. //调用系统播发电话
  18. startActivity(intent);
  19. }
  20. }
  21. }
  22. 系统描述文件:
  23. <uses-permission android:name="android.permission.CALL_PHONE"/> permission是权限节点
  24. 点击事件:
  25. <!-- 只要在布局文件指定了onclick的属性,
  26. 代表就是当这个按钮被点击的时候,会执行activity里面的方法
  27. 方法名 haha -->
  28. <Button
  29. android:onClick="gaga"
  30. android:layout_width="wrap_content"
  31. android:layout_height="wrap_content"
  32. android:layout_alignParentLeft="true"
  33. android:layout_below="@+id/button1"
  34. android:layout_marginTop="40dp"
  35. android:text="按钮02" />
  36. //点击事件的第四种写法 直接在布局xml文件里面指定点击事件的方法名
  37. public void gaga(View view){
  38. Toast.makeText(MainActivity.this, "嘎嘎", 0).show();
  39. }

相对布局:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent" >
  5.  
  6. <Button
  7. android:id="@+id/bt_middle"
  8. android:layout_width="wrap_content" 宽度为包裹内容
  9. android:layout_height="wrap_content"
  10. android:layout_centerHorizontal="true" 父窗口水平居中
  11. android:layout_centerVertical="true" 父窗口垂直居中
  12. android:text="中间" />
  13.  
  14. <Button
  15. android:id="@+id/up"
  16. android:layout_width="wrap_content"
  17. android:layout_height="wrap_content"
  18. android:layout_above="@id/bt_middle""中间"按钮的上方
  19. android:layout_centerHorizontal="true" 水平居中
  20. android:text="上" />
  21.  
  22. <Button
  23. android:id="@+id/down"
  24. android:layout_width="wrap_content"
  25. android:layout_height="wrap_content"
  26. android:layout_below="@id/bt_middle""中间"按钮的下方
  27. android:layout_centerHorizontal="true" 水平居中
  28. android:text="下" />
  29.  
  30. <Button
  31. android:id="@+id/left"
  32. android:layout_width="wrap_content"
  33. android:layout_height="wrap_content"
  34. android:layout_centerVertical="true" 水平居中
  35. android:layout_toLeftOf="@id/bt_middle""中间"按钮的左方
  36. android:text="左" />
  37.  
  38. <Button
  39. android:id="@+id/right"
  40. android:layout_width="wrap_content"
  41. android:layout_height="wrap_content"
  42. android:layout_centerVertical="true" 水平居中
  43. android:layout_toRightOf="@id/bt_middle""中间"按钮的右方
  44. android:text="右" />
  45.  
  46. <Button
  47. android:layout_above="@id/left"
  48. android:layout_toLeftOf="@id/up"
  49. android:layout_width="wrap_content"
  50. android:layout_height="wrap_content"
  51. android:text="左上" />
  52.  
  53. <Button
  54. android:layout_below="@id/left" left下面
  55. android:layout_toLeftOf="@id/up" up左边
  56. android:layout_width="wrap_content"
  57. android:layout_height="wrap_content"
  58. android:text="左下" />
  59.  
  60. <Button
  61. android:layout_above="@id/right"
  62. android:layout_toRightOf="@id/up"
  63. android:layout_width="wrap_content"
  64. android:layout_height="wrap_content"
  65. android:text="右上" />
  66.  
  67. <Button
  68. android:layout_below="@id/right"
  69. android:layout_toRightOf="@id/up"
  70. android:layout_width="wrap_content"
  71. android:layout_height="wrap_content"
  72. android:text="右下" />
  73.  
  74. <Button
  75. android:layout_alignParentTop="true" 父亲的顶部对其
  76. android:layout_width="fill_parent" 宽度为填充父窗口
  77. android:layout_height="wrap_content" 高度为包裹内容
  78. android:text="顶部" />
  79.  
  80. <Button
  81. android:layout_alignParentBottom="true"
  82. android:layout_width="fill_parent"
  83. android:layout_height="wrap_content"
  84. android:text="底部" />
  85.  
  86. <Button
  87. android:layout_marginTop="45dip" 与顶部距离
  88. android:layout_marginBottom="45dip" 与底部距离
  89. android:layout_alignParentLeft="true"parent左边对其
  90. android:layout_width="60dip"
  91. android:layout_height="fill_parent" 高度填充父窗体
  92. android:text="左边" />
  93.  
  94. <Button
  95. android:layout_marginTop="45dip"
  96. android:layout_marginBottom="45dip"
  97. android:layout_alignParentRight="true"parent右边对其
  98. android:layout_width="60dip"
  99. android:layout_height="fill_parent"
  100. android:text="右边" />
  101. </RelativeLayout>

桢布局:FrameLayout 帧布局,布局层层叠加覆盖的

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:background="#ff0000" > 布局背景颜色为红色
  6.  
  7. <TextView 将会覆盖上面的桢布局
  8. android:layout_gravity="center" 对其方式居中对其,水平垂直居中对其
  9. android:layout_width="200dip"
  10. android:layout_height="200dip"
  11. android:background="#00ff00" />
  12.  
  13. <TextView
  14. android:layout_gravity="center"
  15. android:layout_width="100dip"
  16. android:layout_height="100dip"
  17. android:background="#0000ff" />
  18.  
  19. <TextView
  20. android:layout_gravity="center"
  21. android:layout_width="50dip"
  22. android:layout_height="50dip"
  23. android:background="#ff00ff" />
  24. <TextView
  25. android:layout_gravity="center"
  26. android:layout_width="20dip"
  27. android:layout_height="20dip"
  28. android:background="#ffff00" />
  29. </FrameLayout>

绝对布局:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent" >
  5.  
  6. <Button
  7. android:id="@+id/button1"
  8. android:layout_width="wrap_content"
  9. android:layout_height="wrap_content"
  10. android:layout_x="36dp"
  11. android:layout_y="222dp"
  12. android:text="Button" />
  13.  
  14. <TextView
  15. android:id="@+id/textView1"
  16. android:layout_width="wrap_content"
  17. android:layout_height="wrap_content"
  18. android:layout_x="48dp"
  19. android:layout_y="95dp"
  20. android:text="Large Text"
  21. android:textAppearance="?android:attr/textAppearanceLarge" />
  22.  
  23. </AbsoluteLayout>

表格布局:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent" 宽度填充父窗体和match_parent一样
  4. android:layout_height="match_parent" >
  5.  
  6. <TableRow 一行
  7. android:layout_width="match_parent"
  8. android:layout_height="wrap_content" > 高度为包裹的内容,里面控件有多高就多高
  9.  
  10. <TextView 第一列
  11. android:layout_width="wrap_content" 宽度为包裹内容
  12. android:layout_height="wrap_content"
  13. android:text="姓名:" />
  14.  
  15. <EditText 第二列
  16. android:layout_width="200dip"
  17. android:layout_height="wrap_content" />
  18. </TableRow>
  19.  
  20. <TableRow 二行
  21. android:layout_width="match_parent"
  22. android:layout_height="wrap_content" >
  23.  
  24. <TextView
  25. android:layout_width="wrap_content"
  26. android:layout_height="wrap_content"
  27. android:text="身份证号码:" />
  28.  
  29. <EditText
  30. android:layout_width="200dip"
  31. android:layout_height="wrap_content" />
  32. </TableRow>
  33.  
  34. <TableRow
  35. android:layout_width="match_parent"
  36. android:layout_height="wrap_content" >
  37.  
  38. <TextView
  39. android:layout_width="wrap_content"
  40. android:layout_height="wrap_content"
  41. android:text="居住地址:" />
  42.  
  43. <EditText
  44. android:layout_width="200dip"
  45. android:layout_height="wrap_content" />
  46. </TableRow>
  47.  
  48. </TableLayout>

android 55的更多相关文章

  1. Android 6.0一个完整的native service

     上一篇博客<Android 6.0 如何添加完整的系统服务(app-framework-kernel)>http://www.cnblogs.com/hackfun/p/7418902. ...

  2. Android零基础入门第55节:ImageSwitcher和TextSwitcher使用

    原文:Android零基础入门第55节:ImageSwitcher和TextSwitcher使用 上一期我们了解了ViewAnimator组件和ViewSwitcher组件的使用,你都掌握了吗?本期一 ...

  3. 55.Android之AsyncTask介绍 (转)

    AsyncTask和Handler对比 1 ) AsyncTask实现的原理,和适用的优缺点 AsyncTask,是android提供的轻量级的异步类,可以直接继承AsyncTask,在类中实现异步操 ...

  4. android学习笔记55——ContentProvider_2

    实现ContentProvider 创建ContentProvider的步骤: 1.开发一个ContentProvider的子类,该子类需要实现增.删.改.查等方法: 2.在AndroidMainfe ...

  5. 【Android Developers Training】 55. 序言:高效显示位图

    注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...

  6. 55、Android网络图片 加载缓存处理库的使用

         先来一个普通的加载图片的方法. import android.annotation.SuppressLint; import android.app.Activity; import and ...

  7. Android(java)学习笔记55:LayoutInflater 和 findViewById

    1. 在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById(). 不同点是LayoutInflater是用来找res/layout/下的xml布局文件, ...

  8. 55、android app借助友盟实现微信授权登录

    一.去微信开放平台的管理中心申请移动设备的审核(需进行开发者资质认证,每年300元) 1.获取应用的签名 2.在微信开放平台申请移动应用 两个注意点:①签名要填对 ②应用的包名要写对(tips: co ...

  9. Gradle 实现 Android 多渠道定制化打包

    Gradle 实现 Android 多渠道定制化打包 版权声明:本文为博主原创文章,未经博主允许不得转载. 最近在项目中遇到需要实现 Apk 多渠道.定制化打包, Google .百度查找了一些资料, ...

随机推荐

  1. 帝国cms在任意位置调用指定id的栏目名称和链接

    注意,这个代码无须放在灵动标签中,直接写入模板相应的位置就行了.[1]调用栏目名称: <?=$class_r[栏目ID]['classname']?>   示例:<?=$class_ ...

  2. C#Winform开发平台企业版V4.0功能表

    企业版V4.0 - 功能列表及模板窗体 C/S系统开发框架-企业版 V4.0 (Enterprise Edition) 简介: http://www.csframework.com/cs-framew ...

  3. 精通 Oracle+Python,第 3 部分:数据解析

    进行数据解析的理由不计其数,相关的工具和技巧也同样如此.但是,当您需要用这些数据做一些新的事情时,即使有“合适的”工具可能也是不够的.这一担心对于异类数据源的集成同样存在.用来做这项工作的合适工具迟早 ...

  4. Python 学习之urllib模块---用于发送网络请求,获取数据(2)

    接着上一次的内容. 先说明一下关于split()方法:它通过指定分隔符对字符串进行切片,如果参数num 有指定值,则仅分隔 num 个子字符串(把一个字符串分割成很多字符串组成的list列表) 语法: ...

  5. debug(fmt,args...)调试

    1.定义宏(debug.h) #ifndef __DEBUG__H #define __DEBUG__H #include <stdio.h> #ifdef DEBUG #define d ...

  6. Java实现Http服务器(四)

    (1)HTTPServer的监听启动 sun.net.httpserver.ServerImpl类中启动了Socket监听,ServerImpl的内部类Dispatch类启动了Http服务器的监听 / ...

  7. win32画线考虑去锯齿

    整理日: 2015年2月16日 这几天一直在研究win32 SDk下画线去锯齿,之前一直用的QT的画线接口函数,里面有去锯齿的效果,可是突然项目要求不能用QT的只能用win32 SDK下的GDI画线接 ...

  8. server-send event object

    http://jamie-wang.iteye.com/blog/1849193 event -- onmessage, onopen, onerror 不是方法,而是事件 http://school ...

  9. 你真的了解 MySQL 数据库的运行状况吗?

    2015年第三方市场调查机构 Evans 数据公司最近公布的一系列客户调查数据显示,在过去两年里,MySQL 在所有开发者使用的数据库中获得了25%的市场份额,Evans 公司的本次调查显示,数据库的 ...

  10. 大数据计算新贵Spark在腾讯雅虎优酷成功应用解析

    http://www.csdn.net/article/2014-06-05/2820089 摘要:MapReduce在实时查询和迭代计算上仍有较大的不足,目前,Spark由于其可伸缩.基于内存计算等 ...