天天看點

Android Jetpack系列學習一基本介紹

1. 什麼是Jetpack?

Jetpack按照字面意思解釋為噴氣發動機元件,其實際含義也差不多如此。jetpack是2018年谷歌I/O 釋出的一套元件、工具和指導,合稱為jetpack。

2.學習Jetpack的意義?

Google官方文檔上介紹

Jetpack is a collection of Android software components to make it easier for you to develop great Android apps. These components help you follow best practices, free you from writing boilerplate code, and simplify complex tasks, so you can focus on the code you care about.
Jetpack comprises the androidx.* package libraries, unbundled from the platform APIs. This means that it offers backward compatibility and is updated more frequently than the Android platform, making sure you always have access to the latest and greatest versions of the Jetpack components.

Android Jetpack 元件以“未捆綁的”庫形式提供,這些庫不是基礎 Android 平台的一部分。這就意味着,您可以根據自己的需求采用每一個元件。在新的 Android Jetpack 功能釋出後,您可以将其添加到自己的應用中,将您的應用部署到應用商店并向使用者提供新功能,如果您的行動足夠快,所有這些可以在一天内完成!未捆綁的 Android Jetpack 庫已經全部轉移到新的 androidx.* 命名空間中。

此外,您的應用可以在各個版本的平台上運作,因為 Android Jetpack 元件可以獨立于任何特定版本提供功能,進而實作向後相容性。

(出自這篇文章感覺翻譯的挺好)

在我看來谷歌提出這一系列的元件是想引領Android開發者逐漸統一開發規範,把現在好的一系列第三方吸納進來。在原來感覺Android開發一直是放任自流的狀态,從現在每次的Android版本更新都能體會的出來。谷歌在一步步的引領着開發者們往統一的方向标準發展。最明顯的應該是kotlin出來,現在最新的一些demo都是用kotlin寫的了,是以對于我們開發者們來說谷歌提倡鼓勵的新的元件都要學習起來了。

3.jetpack包括哪些東西?

jetpack包含一系列的元件,以後會慢慢一個個詳細的去學習記錄下這裡先整體了解一下。

Android Jetpack系列學習一基本介紹
  1. Foundation
Foundation components provide cross-cutting functionality like backwards compatibility, testing and Kotlin language support.
Android Jetpack系列學習一基本介紹

基礎元件提供了跨領域的功能,如向後相容性、測試和Kotlin語言支援

  1. Architecture
Architecture components help you design robust, testable and maintainable apps.

架構元件這個比較關鍵,是我們要學習的重點包括

  • Data Binding 資料綁定
  • Lifecycles 管理Activity和Fragment生命周期
  • LiveData 感覺資料變化更新ui
  • Navigation 字意為導航。多Fragment轉場,棧管理
  • Paging 分頁處理
  • Room 資料庫管理
  • ViewModel ui界面的資料管理
  • WorkManager 背景工作管理
  1. Behavior
  2. UI