当前位置: 移动技术网 > 网络运营>服务器>Linux > Android学习笔记 --翻译

Android学习笔记 --翻译

2020年07月23日  | 移动技术网网络运营  | 我要评论

第一周

Android System Architecture(Android 系统架构)

在这里插入图片描述
Android is an open source, Linux-based software stack created for a wide array of devices and form factors.
Android 是一个开源的,基于Linux的用于针对不同尺寸的移动设备创建界面的软件堆栈。

系统架构:

  1. System Apps
  2. Java API Framework
    • View System
    • Resource Manager,
    • Notification Manager
    • Activity Manager
    • Content Providers
  3. Native C/C++ Libraries
  4. Android Runtime
  5. Hardware Abstraction Layer(HAL)
  6. Linux Kernel
  7. Power Management

Application层: 也就是应用层,不仅包括通话短信联系人这种系统级的应用,还包括用户自己安装的一些第三方应用
Framework层:这一层大部分用Java写的,包括系统服务和四大组件
Library层:这一层大部分都是C/C++写的,主要是虚拟机,还有一些三方库比如SQLite, WebKit
HAL层:硬件抽象层,
Linux内核层:包含Linux内核和一些驱动,比如说蓝牙驱动,Camera驱动等等,这个Binder驱动也是在这一层

Android Platform

The Android platform provides a framework API that applications can use to interact with the underlying Android system.
The framework API consists of:

  1. A core set of packages and classes
  2. A set of XML elements and attributes for declaring a manifest file
  3. A set of XML elements and attributes for declaring and accessing resources
  4. A set of Intents
  5. A set of permissions that applications can request, as well as permission enforcements included in the system

Android platform 提供了一个让应用可以和底层Android系统进行交互的API框架。

Android Platform Updates

Updates to the framework API are designed so that the new API remains compatible with earlier versions of the API.

two case:

  1. Most changes in the API are additive and introduce new or replacement functionality ==>In this case, the older replaced parts are deprecated but are not removed
  2. In a very small number of cases, parts of the API may be modified or removed ==> In this case, typically such changes are only needed to ensure API robustness and application or system security

更新API框架被设计以便于新老API可以兼容。

有两种情况:

  1. 绝大多数API更新是添加或替换新功能。
  2. 极少数情况是移除或修改部分API

API Levels and Android Platform Versions

API Level

  • An integer value
  • It uniquely identifies the framework API revision offered by a version of the Android platform

API Level ≠ Android Platform Version

Uses of API Level in Android

minSdkVersion:最小的API Level。
targetSdkVersion:目标SDK版本,建议使用最新。
compileSdkVersion:编译工程的SDK版本。不应该比targetSdkVersion低。
maxSdkVersion:最大的API Level。

第二周

An Overview of Layouts(布局概述)

Views and ViewGroups

  • A layout defines the structure for a user interface in your app
  • All elements in the layout are build using a hierarchy of View and
    ViewGoup objects
  • 布局定义了应用程序中用户界面的结构
  • 布局中的所有元素都使用视图和ViewGoup对象的层次构建
    在这里插入图片描述

Layout Resources(布局资源)

A layout resource defines the architecture for the UI in an Activity or a component of a UI
布局资源定义了Activity或UI组件中UI的体系结构
在这里插入图片描述

Several Important Classes(几个重要的类)

View Class

The View class represents the basic building block for UI components.
There are many specialized subclasses of views that act as controls or are capable of displaying text, images, or other content.

View类代表UI组件的基本构建块。
有许多专用的视图子类可以充当控件或能够显示文本,图像或其他内容。

View Class的通用属性:

  1. IDs:
    “@+id/idName” – 例如 @+id/mybutton
    “@id/idName” – 例如 @id/mybutton
    在这里插入图片描述

  2. android:layout_height 和 android:layout_width
    在这里插入图片描述
    尺寸值:
    基于屏幕物理尺寸的单位:in,mm,pt。1 in = 25.4 mm = 72 pt。他们无法在所有设备上正常运行。
    基于像素:Pixel(像素),Resolution(分辨率),Pixel Density:(像素密度 dpi)
    px,dp,sp。px = dp * (dpi / 160)
    match_parent:该视图希望与父视图一样大(减去父视图的填充,如果有的话)
    wrap_content:视图要足够大以包围其内容(考虑其自身的填充)

  3. Padding
    它定义了视图边缘和视图内容之间的空间
    android:paddingTop 上
    android:paddingBottom 下
    android:paddingLeft 左
    android:paddingRight 右
    android:paddingStart 基于ui设置
    andorid:paddingEnd 基于ui设置
    在这里插入图片描述

View Group Class

View Group Class包含其他视图的特殊视图
属性:

  1. Paddings and Margins
    在这里插入图片描述

LinearLayout

  1. android:orientation
    android:orientation=“vertical” 垂直对齐
    android:orientation=“horizontal” 水平对齐
    在这里插入图片描述
  2. android:gravity
    它指定对象应如何在其自身范围内在X轴和Y轴上定位其内容。
    它的值可以是以下常量值中的一个或多个(以“ |”分隔):
    在这里插入图片描述

TextView and Button

属性:

  1. android:textColor
  2. android:textStyle
  3. android:textSize

第三周

Introduction to Activities

Activities概念

理解活动的生命周期:
在这里插入图片描述
onCreate()

Intents (Basics)

本文地址:https://blog.csdn.net/qq_41202539/article/details/107500118

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网