gpt4 book ai didi

android - 如何在EpoxyModelWithHolder中获得项目位置?

转载 作者:行者123 更新时间:2023-12-02 13:26:51 25 4
gpt4 key购买 nike

我正在尝试使用环氧树脂库将RecyclerView添加到我的应用程序中
我需要在bind中的EpoxyModelWithHolder方法中获取项目的位置,但我不知道该怎么做。
我找不到任何函数来获取持有人/物品的位置。

最佳答案

解决方案是在模型中具有Integer EpoxyAttribute,并在 Controller 中将其设置为buildItemModel方法的id。
在您的模型中:

@EpoxyAttribute
Integer position;
在 Controller 中:
public EpoxyModel<?> buildItemModel(int i, yourmodel) {

return model()_.id(i).position(i);

}

关于android - 如何在EpoxyModelWithHolder中获得项目位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63531477/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com