带有数据绑定的AndroidX SwipeRefreshLayout

问题描述 投票:3回答:1

我正在尝试使用AndroidX库实施滑动以刷新功能:androidx.swiperefreshlayout.widget.SwipeRefreshLayout

我的应用程序正在使用Android数据绑定,因此我想使用可观察的字段来控制此小部件的状态。

过去我使用AppCompat one-自从不推荐使用。

之前,我可以通过以下方式访问字段:

<android.support.v4.widget.SwipeRefreshLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:refreshing="@{viewModel.isLoading}">
    ...
    // My RecyclerView here
</android.support.v4.widget.SwipeRefreshLayout>

但是,这似乎不再起作用-使用等效的AndroidX。我想念什么吗?还是有解决方案/解决方法来实现这一目标?

我的项目已完全迁移到AndroidX,没有错误或依赖关系冲突。

android data-binding android-databinding androidx swiperefreshlayout
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.