Constraintlayout
androidx.constraintlayout.widget
這個資料表會列出 androidx.constraintlayout
群組中的所有構件。
構件 | 穩定版 | 候選版本 | Beta 版 | Alpha 版 |
---|---|---|---|---|
constraintlayout | 2.1.3 | - | - | - |
constraintlayout-compose | 1.0.0 | - | - | - |
宣告依附元件
如要在 ConstraintLayout 中新增依附元件,您必須將 Google Maven 存放區新增至專案。詳情請參閱 Google 的 Maven 存放區。
在應用程式或模組的 build.gradle
檔案中,為您需要的構件新增依附元件:
Groovy
dependencies { implementation "androidx.constraintlayout:constraintlayout:2.1.3" // To use constraintlayout in compose implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0" }
Kotlin
dependencies { implementation("androidx.constraintlayout:constraintlayout:2.1.3") }
如要進一步瞭解依附元件,請參閱新增建構依附元件。
意見回饋
您的意見有助於改善 Jetpack。如果您發現新問題,或是對這個程式庫有改進建議,請告訴我們。請先查看這個程式庫的現有問題,再建立新問題。如果要投票給現有問題,請按一下星號按鈕。
詳情請參閱 Issue Tracker 說明文件。
ConstraintLayout-compose 1.0
ConstraintLayout-compose 1.0 在 Jetpack Compose 中提供 ConstraintLayout 功能。
1.0.0 版本
2022 年 1 月 13 日
androidx.constraintlayout:constraintlayout-compose:1.0.0
發布。
請注意,MotionLayout API 目前處於實驗階段,必須啟用才能運作。
詳情請參閱 GitHub 的 1.0 版新功能 (Compose) 一文。
1.0.0-rc02 版本
2021 年 11 月 16 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-rc02
發布。
詳情請參閱 GitHub 的 1.0 版新功能 (Compose) 一文。
1.0.0-rc01 版本
2021 年 9 月 27 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-rc01
發布。
這個版本為第二個 Beta 版。系統會將此版本視為功能完整的版本,可為 Compose 提供 ConstraintLayout
和 MotionLayout
。
詳情請參閱 GitHub 的 1.0 版新功能 (Compose) 一文。
1.0.0-beta02 版本
2021 年 7 月30 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02
發布。
這個版本為第二個 Beta 版。系統會將此版本視為功能完整的版本,可為 Compose 提供 ConstraintLayout
和 MotionLayout
。
詳情請參閱 GitHub 的 1.0 版新功能 (Compose) 一文。
1.0.0-beta01 版本
2021 年 7 月 22 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-beta01
發布。
這個版本為第一個 Beta 版,系統會將此版本視為功能完整的版本,可為 Compose 提供 ConstraintLayout
和 MotionLayout
。
詳情請參閱 GitHub 的 1.0 版新功能 (Compose) 一文。
1.0.0-alpha07 版本
2021 年 5 月 18 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha07
發布。
- 更新為相容於 Compose
1.0.0-beta07
版本。
1.0.0-alpha06 版本
2021 年 5 月 4 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha06
發布。
- Compose 最佳化:Constraintlayout 內嵌組件 (#193)
- 盡量減少在 Compose 中的重新評估 (#210)
1.0.0-alpha05 版本
2021 年 3 月 15 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha05
發布。
- 包含最佳化引擎的修正項目 (b/182657720)
- 將 optimizationLevel 參數新增至 ConstraintLayout 組件
1.0.0-alpha04 版本
2021 年 3 月 11 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha04
發布。
更新為採用最新 constraintlayout-core 引擎
1.0.0-alpha03 版本
2021 年 2 月 24 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha03
發布。
Jetpack Compose beta01 版本更新
1.0.0-alpha02 版本
2021 年 2 月 10 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha02
發布。
Jetpack Compose alpha12 版本更新
1.0.0-alpha01 版本
2021 年 2 月 2 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha01
發布。
程式庫的第一個版本,提供內嵌和外部 DSL 來表達限制。
2.1 版本
ConstraintLayout 2.1.0 在 MotionLayout 中提供更豐富的功能和全新的輔助工具 (輪轉介面等)
2.1.3 版本
2022 年 1 月 13 日
androidx.constraintlayout:constraintlayout:2.1.3
發布。
詳情請參閱 GitHub 的 2.1 版新功能一文。
2.1.2 版本
2021 年 11 月 16 日
androidx.constraintlayout:constraintlayout:2.1.2
發布。
詳情請參閱 GitHub 的 2.1 版新功能一文。
2.1.1 版本
2021 年 9 月 27 日
androidx.constraintlayout:constraintlayout:2.1.1
發布。
這是 2.1.1 的最終版本。
詳情請參閱 GitHub 的 2.1 版新功能一文。
2.1.0 版本
2021 年 7 月30 日
androidx.constraintlayout:constraintlayout:2.1.0
發布。
這是 2.1.0 的最終版本。
詳情請參閱 GitHub 的 2.1 版新功能一文。
2.1.0-rc01 版本
2021 年 7 月 22 日
androidx.constraintlayout:constraintlayout:2.1.0-rc01
發布。
這是 2.1.0 版本的候選版本,針對上次的 Beta 版提供小幅改善和修正。詳情請參閱 GitHub 的 2.1 版新功能一文。
2.1.0-beta02 版本
2021 年 5 月 4 日
androidx.constraintlayout:constraintlayout:2.1.0-beta02
發布。
MotionLayout 中的幾項新功能:
- OnSwipe 強化效果,包括 Spring (剛硬、抑制、集結等) 與永不完成
- jumpToState 函式
- 在 ViewTransition downUp 模式中輕觸「向下」時,會播放至 100,輕觸「向上」則會還原為 0
修正多項問題,值得注意的有:
- 修正 MotionLayout 中垂直捲動的問題 (#173)
- 改善巢狀 MotionLayout 的效能 (#189)
- 在 MotionLayout 中運用 NestedScrollView 快速轉場 (#189)
- 在 MotionLayout 中移除 ConstraintSet (#189)
- 在 MotionLayout 中支援 downUp ViewTransitions (#190)
- 修正重複使用可繪項目時 ImageFilter 中的內容 (#192)
- 在 MotionLayout 新增 Spring 支援 (#199)
- CircularFlow 效能改善 (#200)
- 修正衍生限制/限制覆寫 (#212)
2.1.0-beta01 版本
2021 年 3 月 11 日
androidx.constraintlayout:constraintlayout:2.1.0-beta01
發布。
ConstraintLayout
由於發生相容性問題,因此 android:layout_width 和 android:layout_height 變更回非選用項目。
MotionLayout
- 針對「轉場」支援以程式輔助方式插入及移除 onSWipe 和 onClick
- 實驗性支援透過畫面旋轉進行「轉場」
- 針對轉場支援持續時間引數
- 針對屬於布林值或參考資料的 customAttributes 提供更完善的支援
輔助工具
- 新增一種方式以透過動畫或跳躍直接前往輪轉介面的特定項目
- 全新 CircularFlow 輔助工具
2.1.0-alpha2 版本
2020 年 12 月 17 日
androidx.constraintlayout:constraintlayout:2.1.0-alpha2
發布。
這是第二個 Alpha 版,新增了幾項功能:
ConstraintLayout
- android:layout_width 和 android:layout_height 現在為選用項目,預設行為是 wrap_content
- 新增 layout_constraintWidth 和 layout_constraintHeight 屬性,用於表示尺寸限制
- 支援使用負數邊界設定限制
- 支援頂端基準和底端基準限制
- 支援基準邊界限制
- SharedValues 可讓您將外部值插入 ConstraintLayout 中
MotionLayout
- 支援過衝內插器 (預判、過衝)
- 強化版 MotionHelper 支援
- 將 ConstraintSet 的動畫式更新新增至 MotionLayout updateStateAnimate(id,cset,duration);
- 共用以價值為準 ViewTransition
- scheduleTransitonTo 可讓您安排某個轉場在目前轉場完成後執行。
輔助工具
- 輪轉介面現已支援無限 (圍繞) 模式
- ReactiveGuide:SharedValue 變更時會自動安置自身位置的指南
- MotionAction:將主要畫面格插入至正往指定方向移動的參照檢視畫面
- MotionLabel - 使單行文字動畫化的檢視畫面
如要瞭解這個版本的更多資訊,請參閱這裡。
2.1.0-alpha1 版本
2020 年 11 月 19 日
androidx.constraintlayout:constraintlayout:2.1.0-alpha1
發布。
2.1 版本的第一個 Alpha 版。開始支援下列項目:
- 輪轉介面動作輔助工具,用於建立自訂輪轉介面檢視畫面
- MotionLayout 場景支援納入與限制覆寫
- MotionLayout 針對旋轉功能新增更多支援 (輸入和輸出)
- MotionLayout 新增 ViewTransfers,允許針對 constraintsets 的變化進行單一檢視畫面轉場
如要瞭解這個版本的更多資訊,請參閱這裡。
2.0 版本
ConstraintLayout 2.0 針對版面配置新增功能 (虛擬版面配置等),並針對簡化檢視畫面動畫提供新的類別 MotionLayout。
2.0.4 版本
2020 年 10 月 29 日
androidx.constraintlayout:constraintlayout:2.0.4
發布。
修正錯誤
這個版本修正了在執行階段移除子項檢視畫面時可能發生的 NPE。建議更新至這個版本。
如要查看已關閉的問題清單,請按這裡。
2.0.3 版本
2020 年 10 月 27 日
androidx.constraintlayout:constraintlayout:2.0.3
發布。
修正錯誤
這個版本修正了一些問題。建議更新至這個版本。
- Windows 插邊處理
- 在某些情況中的尺寸比例處理
- 某些由右至左版面配置當機問題
如要查看已關閉的問題清單,請按這裡。
2.0.2 版本
2020 年 10 月 6 日
androidx.constraintlayout:constraintlayout:2.0.2
發布。
修正錯誤
這個版本可提高效能並修正了一些問題。建議更新至這個版本。
- 某些情況下,在 ConstraintLayout 中處理檢視 Gone 顯示設定的方式有誤
- 某些情況下,在 ConstraintLayout 中處理封裝鏈的方式有誤
- 針對「流程」虛擬版面配置輔助工具修正 API 15 上的加載例外
- limitBoundsTo 在 MotionLayout 中損毀
- 某些情況下,MotionLayout 中的跳至結尾功能損毀 (鏈結轉場)
如要查看已關閉的問題清單,請按這裡。
2.0.1 版本
2020 年 8 月 25 日
androidx.constraintlayout:constraintlayout:2.0.1
發布。
此為小幅更新,啟用在 Android Studio 中使用 MotionEditor 的功能。
2.0.0 版本
2020 年 8 月 21 日
androidx.constraintlayout:constraintlayout:2.0.0
發布。
修正錯誤
如要查看已關閉的問題清單,請按這裡。
重要修正項目如下:
- MotionLayout 轉場延遲和 TransitionListener 修正
- ConstraintLayout 流程與障礙修正
2.0.0-rc1 版本
2020 年 7 月 29 日
androidx.constraintlayout:constraintlayout:2.0.0-rc1
發布。
修正錯誤
如要查看已關閉的問題清單,請按這裡。
重要修正項目如下:
- 修正流程
- RecyclerView 修正 (建議更新到 recyclerview 1.2.0 alpha 5 以上版本)
- MotionLayout TransitionListener 修正
- MotionLayout 記憶體外洩修正
2.0.0-beta8 版本
2020 年 7 月 7 日
androidx.constraintlayout:constraintlayout:2.0.0-beta8
發布。
修正錯誤
如要查看已關閉的問題清單,請按這裡。
重要修正項目如下:
- 預留位置行為
- 資料層顯示設定
- 流程、障礙修正
- TransitionListener 修正
2.0.0-beta7 版本
2020 年 6 月 12 日
androidx.constraintlayout:constraintlayout:2.0.0-beta7
發布。
修正錯誤
如要查看已關閉的問題清單,請按這裡。
重要修正項目如下:
- MotionLayout 中的巢狀捲動檢視畫面問題
- MotionLayout 轉場事件監聽器問題
- MotionLayout 中的記憶體流失問題
- RecyclerView 問題
- 群組顯示設定
- 邊框間距問題
2.0.0-beta6 版本
2020 年 5 月 13 日
androidx.constraintlayout:constraintlayout:2.0.0-beta6
發布。
修正錯誤
如要查看已關閉的問題清單,請按這裡。重要修正包括 MotionLayout 中的群組顯示設定處理和衍生限制問題。
2.0.0-beta5 版本
2020 年 5 月 7 日
androidx.constraintlayout:constraintlayout:2.0.0-beta5
發布。
修正錯誤
如要查看已關閉的問題清單,請按這裡
2.0.0-beta4 版本
2019 年 12 月 16 日
androidx.constraintlayout:constraintlayout:2.0.0-beta4
發布。
新功能
MotionLayout
轉場中的新屬性:
- layoutDuringTransition:讓您設定 MotionLayout 如何回應子項在轉場期間的 requestLayouts 呼叫。可能的值為 {ignoreRequest, honorRequest}
- pathMotionArc:元素移動時採用的路徑會使用弧形。可能的值為 {startVertical | startHorizontal | flip | none }
預設轉場現在可以省略起始和結束 ConstraintSets 而進行定義。如果沒有符合目前開始/結束狀態的其他現有轉場,系統就會採用預設轉場。
修正錯誤
如要查看已關閉的問題清單,請按這裡