Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onBing 方法中怎样能获取到 oncreate 定义的字段 #379

Closed
530l opened this issue Jul 16, 2023 · 3 comments
Closed

onBing 方法中怎样能获取到 oncreate 定义的字段 #379

530l opened this issue Jul 16, 2023 · 3 comments

Comments

@530l
Copy link

530l commented Jul 16, 2023

问题描述

onCreate() 是创建 onCreateViewHolder 的回调,我想定义一些字段是根据 hodel 创建的声明周期走的,我应该定义在 oncreate 里面,然后自己缓存起来吗,再 onBind()方法关联起来,还是怎样? onBing 方法中怎样能获取到 oncreate 定义的字段

 onCreate {
               if (itemViewType == R.layout.xxxxx_header){}
               if (itemViewType == R.layout.xxxxx_info){
                      var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
               }
        }

onBind {

           gsyVideoOptionBuilder.setXXXXXXX
}

期望结果

如何复现

希望快速解决请Fork仓库复现问题并附上链接, 否则只能等有空才能排查
凭空猜测只会让问题晦涩难懂, 浪费本项目可持续维护时间

截图

异常堆栈信息或者手机截图/视频(拖拽到输入框即可上传)

版本

  • BRV:1.4.2
  • Android: 13
  • Gradle: 7.0
  • Android Studio: Android Studio Bumblebee | 2021.1.1 Patch 2
@liangjingkanji
Copy link
Owner

  1. 使用ViewHolder的itemView.setTag去读写对象
  2. onBind里面去判断itemViewType

不过我认为可以给BindViewHodler新增一个tag变量来存储

@530l
Copy link
Author

530l commented Jul 16, 2023

这个可以,给BindViewHodler新增一个tag变量来存储,有空增加下

@liangjingkanji
Copy link
Owner

已完成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants