如何在 Android Studio 中使用 ObservableList?
我必须在我的 android 项目中使用此代码,但我在 Android 中找不到它.
I must use this code on my android Project but I can't find it in Android.
我在谷歌上搜索并发现有android.databind.ObservableArrayList",但在 Android Studio 中我找不到它.
I google it and find there is "android.databind.ObservableArrayList" but in Android Studio I can't find it.
private ObservableList<Urunler> data = FXCollections.observableArrayList();
要使用 ObservableArrayList
,您需要从 Android SDK 管理器中的支持存储库下载库.
To use ObservableArrayList
you need to download the library from the Support repository in the Android SDK manager.
要将您的应用配置为使用数据绑定,请将 dataBinding
元素添加到应用模块中的 build.gradle 文件中.
To configure your app to use data binding, add the dataBinding
element to your build.gradle file in the app module.
使用以下代码片段配置数据绑定:
Use the following code snippet to configure data binding:
dataBinding {
enabled = true
}
之后你就可以在Android Studio中使用ObservableArrayList
after that you will be able to use ObservableArrayList
in Android Studio
(阅读文档)