Android入门教程3【Hello Android!】

Android入门教程3 Android开发Hello Android!Android的HelloWord!

上一节我们已经把java和AndroidStudio装好了,接下来要创建项目了哦!

直接上图

第一步:选择File -> New -> New Propect

第二步:输入项目名称,包名等信息。

包名可以自定义,一般格式大家都喜欢以com开头之后.(点)公司名称.项目名称。com.abysskitty[公司名称].Demo[项目名称]。当然自定义也行,你起成a.b.c也是可以的,不过最好按照规范来。

Application name :项目名称。

Company domain :是倒着的。com结尾

Package name :是正着的。com开头(包名,非常重要,就相当于你开发的这个app的身份证)

Project location :项目保存路径。



第三步:选择版本(我一般选4.4)


第四步:创建项目的格式(选择Empty Activity)



第五步:点  Finish

之后等待进度条创建项目。


项目创建之后的页面是这样的:

  1. MainActivity是程序主入口。
  2. activity_main是主入口的视图。

这里我们点击视图页面,进行修改。




第六步:用数据线连接手机,并打开手机开发者模式,打开USB调试选项。

这里的话,不懂的话可以自行百度。

可以这样搜索:“例如:华为荣耀V10 如何打开开发者选项USB调试
打开之后用手机连接电脑,手机会弹出 是否信任此电脑 的选项,点击同意。

第七步:选择app,点击运行按钮。


第八步:等待手机弹出同意安装选项。

恭喜!您的第一个Android程序运行成功啦。

  • 3
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目录 第一篇 Android 系统结构和SDK 使用............................................................................................................................ 5 第1 章 Android 的系统介绍........................................................................................................................................... 5 1.1 系统介绍........................................................................................................................................................... 5 1.2 软件结构和使用的工具................................................................................................................................... 7 第2 章 Android SDK 的开发环境.................................................................................................................................. 10 2.1 Android SDK 的结构...................................................................................................................................... 10 2.2 Android SDK 环境安装.................................................................................................................................. 11 2.2.1. 安装JDK 基本Java 环境。................................................................................................................ 11 2.2.2. 安装Eclipse........................................................................................................................................... 12 2.2.3. 获得Android SDK ...............................................................................................................................12 2.2.4(1). 在Eclipse 3.4(Ganymede)中安装ADT............................................................................... 14 2.2.4(2). 在Eclipse 3.5(Galileo)中安装ADT..................................................................................... 17 2.2.5. 在Eclipse 中配置Android SDK ......................................................................................................... 20 2.3 Android 中运行仿真器环境............................................................................................................................ 21 2.3.1. 建立Android 虚拟设备....................................................................................................................... 21 2.3.2. 运行虚拟设备........................................................................................................................................ 22 2.3.3. 使用Android 中的工具....................................................................................................................... 23 2.3.4. 使用logcat............................................................................................................................................. 24 2.3.5. 使用仿真器控制.................................................................................................................................... 25 2.3.6. 命令行工具adb、mksdcard 等.......................................................................................................... 26 2.3.7. 使用设备控制........................................................................................................................................ 28 2.4 Android 中建立工程........................................................................................................................................ 29 2.4.1. 建立工程................................................................................................................................................ 29 2.4.2. 查看和编辑各个文件............................................................................................................................ 31 2.4.3. 运行工程................................................................................................................................................ 33 第二篇 Android 应用程序的概述和框架....................................................................................................................... 36 第3 章 Android 应用层程序的开发方式....................................................................................................................... 36 3.1 应用程序开发的结构....................................................................................................................................... 36 3.2 API 参考文档的使用........................................................................................................................................ 36 第4 章Android 应用程序示例........................................................................................................................................ 40 4.1 HelloActivity 程序的运行............................................................................................................................ 40 4.2 HelloActivity 的源文件结构........................................................................................................................ 41 4.2.1.Android.mk 文件................................................................................................................................. 41 4.2.2.AndroidManifest.xml 文件................................................................................................................. 42 4.2.3.源代码文件........................................................................................................................................... 42 4.2.4.布局文件............................................................................................................................................... 43 4.2.5.其他资源文件....................................................................................................................................... 43 4.3 HelloActivity 的编译结构............................................................................................................................ 43 4.4 SkeletonApp 的程序的运行........................................................................................................................ 44 4.5 SkeletonApp 的源文件结构........................................................................................................................ 44 4.6 SkeletonApp 的编译结构............................................................................................................................ 46 第5 章 Android 应用程序的内容................................................................................................................................... 47 5.1 Android 应用程序的概念性描述................................................................................................................. 47 5.1.1.应用程序的组成部分........................................................................................................................... 47 5.1.2.应用程序的生命周期........................................................................................................................... 48 5.2 应用程序包含的各个文件.............................................................................................................................50 5.3 使用am 工具启动Android 应用程序........................................................................................................ 51 2 第三篇Android 的UI 系统实现..................................................................................................................................... 53 第6 章 UI 的基本外形和控制........................................................................................................................................ 53 6.1 控件和基本事件的响应................................................................................................................................. 53 6.1.1.事件响应方法....................................................................................................................................... 54 6.1.2.第二种响应方法................................................................................................................................... 56 6.1.3.第三种响应方法................................................................................................................................... 57 6.2 键盘事件的响应............................................................................................................................................... 57 6.3 运动事件的处理............................................................................................................................................... 59 6.4 屏幕间的跳转和事件的传递........................................................................................................................... 62 6.4.1.跳转的方法........................................................................................................................................... 62 6.4.2.带有返回值的跳转...............................................................................................................................63 6.5 菜单的使用........................................................................................................................................................ 66 6.6 弹出对话框........................................................................................................................................................ 67 6.6.1. 提示信息和两个按钮的对话框............................................................................................................ 68 6.6.2. 提示信息和三个按钮的对话框............................................................................................................ 69 6.6.3. 列表项对话框........................................................................................................................................ 70 6.6.4. 单选项和按钮对话框............................................................................................................................ 70 6.6.5. 复选项和按钮对话框............................................................................................................................ 71 6.6.6. 文本的按键对话框(使用布局文件)................................................................................................ 72 6.7 样式的设置....................................................................................................................................................... 74 6.7.1.预定样式对话框................................................................................................................................... 74 6.7.2.自定义样式对话框...............................................................................................................................74 6.7.3.窗口透明样式示例...............................................................................................................................75 第7 章控件(Widget)的使用..................................................................................................................................... 78 7.1 Android 中控件的层次结构......................................................................................................................... 78 7.2 基本控件的使用............................................................................................................................................. 79 7.2.1.普通按钮............................................................................................................................................... 79 7.2.2.图像区域............................................................................................................................................... 80 7.2.3.图像按钮............................................................................................................................................... 82 7.2.4.进度条................................................................................................................................................... 83 7.2.5.多种控件............................................................................................................................................... 85 7.3 自定义的视图................................................................................................................................................... 86 第8 章视图组(ViewGroup)和布局(Layout)的使用........................................................................................... 89 8.1 Android 的屏幕元素体系................................................................................................................................ 89 8.2 几种独立使用的视图组................................................................................................................................... 90 8.2.1.网页视图............................................................................................................................................... 90 8.2.2.旋转按钮............................................................................................................................................... 91 8.2.3.文本切换器........................................................................................................................................... 93 8.2.4.图像切换器........................................................................................................................................... 94 8.3 作为简单容器使用的视图组........................................................................................................................... 95 8.3.1.单选按钮组........................................................................................................................................... 95 8.3.2.使用滚动条........................................................................................................................................... 96 8.4 布局(Layout) .............................................................................................................................................. 99 8.4.1.基本的布局内容................................................................................................................................... 99 8.4.2.线性布局(LinearLayout) ............................................................................................................. 100 8.4.3.相对布局(RelativeLayout)........................................................................................................... 101 8.4.4.表单布局(Table Layout).............................................................................................................. 103 8.5 网格(Grid)视图组................................................................................................................................... 103 3 8.6 列表(List)视图组.................................................................................................................................... 107 8.7 使用Tab 组织UI ......................................................................................................................................... 109 第9 章 2D 图形接口的使用......................................................................................................................................... 113 9.1 使用2D 图形接口的程序结构。.................................................................................................................. 113 9.2 图像、图形、文本的基本绘制..................................................................................................................... 114 9.3 文本的对齐方式............................................................................................................................................. 116 9.4 使用路径效果(PathEffect) ..................................................................................................................... 118 9.5 剪裁效果......................................................................................................................................................... 119 9.6 记录绘制的过程............................................................................................................................................. 121 9.7 动画效果......................................................................................................................................................... 123 第10 章 OpenGL 3D 图形的使用................................................................................................................................125 10.1 使用OpenGL 图形接口的程序结构。..................................................................................................... 125 10.2 基本的绘制................................................................................................................................................... 126 10.3 渲染器的实现............................................................................................................................................... 127 10.4 3D 动画效果的实现...................................................................................................................................... 129 4
About this Book Android is a software toolkit for mobile phones, created by Google and the Open Handset Alliance. It’s inside millions of cell phones and other mobile devices, making Android a major platform for application developers. That could be your own program running on all those devices. Within minutes, Hello, Android will get you started creating your first working application: Android’s version of “Hello, World.” From there, you’ll build up a more substantial example: an Android Sudoku game. By gradually adding features to the game, you’ll learn the basics of Android programming. You’ll also see how to build in audio and video support, add graphics using 2D and 3D OpenGL, network with web pages and web services, and store data with SQLite. You’ll also learn how to publish your applications to the Android Market. The #1 book for learning Android is now in its third edition. Every page and example was reviewed and updated for compatibility with the latest versions. Freshly added material covers installing applications to the SD card, supporting multi-touch, and creating live wallpaper. You’ll also find plenty of real-world advice on how to support all the Android versions in use today—everything from Cupcake (Android 1.5) to FroYo (Android 2.2) and beyond. If you’d rather be coding than reading about coding, this book is for you. Preface Introducing Android Quick Start Key Concepts excerpt Android Basics Designing the User Interface Exploring 2D Graphics Multimedia Storing Local Data Beyond the Basics The Connected World excerpt Locating and Sensing Putting SQL to Work 3D Graphics in OpenGL The Next Generation Multi-touch There’s No Place Like Home Write Once, Test Everywhere Publishing to the Android Market Appendixes Java vs. the Android Language and APIs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值