Thư viện databinding (liên kết dữ liệu) có sẵn trong trình bổ trợ Android cho Gradle.
Bạn không cần phải khai báo phần phụ thuộc trên thư viện, nhưng bạn phải bật tính năng này.
Để bật tính năng liên kết dữ liệu, hãy đặt tuỳ chọn bản dựng dataBinding thành true trong tệp build.gradle của mô-đun như dưới đây:
Ý kiến phản hồi của bạn có thể giúp chúng tôi cải thiện Jetpack. Hãy cho chúng tôi biết nếu bạn phát hiện lỗi mới hoặc có ý tưởng cải thiện thư viện này. Vui lòng xem các lỗi hiện có trong thư viện này trước khi báo một lỗi mới. Bạn có thể thêm lượt bình chọn cho lỗi hiện có bằng cách nhấp vào nút dấu sao.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Databinding\n===========\n\n[User Guide](/topic/libraries/data-binding) [Code Sample](https://github.com/android/databinding-samples) [Codelab](https://codelabs.developers.google.com/codelabs/android-databinding) \nAPI Reference \n[android.databinding](/reference/android/databinding/package-summary) \nBind UI components in your layouts to data sources in your app using a declarative format. \n\n| Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |\n|-------------------|-------------------------------------------------------|-------------------|--------------|-----------------------------------------------------------------------|\n| September 5, 2019 | [3.5.0](/jetpack/androidx/releases/databinding#3.5.0) | - | - | [3.6.0-alpha10](/jetpack/androidx/releases/databinding#3.6.0-alpha10) |\n\nThe databinding library is bundled with\n[the Android Gradle plugin](/studio/releases/gradle-plugin).\nYou do not need to declare a dependency on the\nlibrary, but you must enable it.\n\nTo enable data binding, set the `dataBinding` build option to `true` in your\nmodule's `build.gradle` file, as shown below: \n\n android {\n ...\n buildFeatures {\n dataBinding true\n }\n }\n\n| **Note:** You must enable data binding for all modules that depend on libraries that use data binding, even if the module doesn't directly use data binding.\n\nFor more information about data binding,\nsee the guide to the [data binding library](/topic/libraries/data-binding),\nand the Android Studio [release notes](/studio/releases)\n\nFeedback\n--------\n\nYour feedback helps make Jetpack better. Let us know if you discover new issues or have\nideas for improving this library. Please take a look at the\n[existing issues](https://issuetracker.google.com/issues?q=componentid:192721%20status:open)\nin this library before you create a new one. You can add your vote to an existing issue by\nclicking the star button.\n\n[Create a new issue](https://issuetracker.google.com/issues/new?component=192721&template=1096850)\n\nSee the [Issue Tracker documentation](https://developers.google.com/issue-tracker)\nfor more information."]]