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

多布局 onCreate 里面判断itemViewType 都是-1 #298

Closed
287138531 opened this issue Nov 22, 2022 · 3 comments
Closed

多布局 onCreate 里面判断itemViewType 都是-1 #298

287138531 opened this issue Nov 22, 2022 · 3 comments
Labels
寻求帮助 Extra attention is needed 提议 New feature or request

Comments

@287138531
Copy link

问题描述

多布局 onCreate 里面判断itemViewType 都是-1
想实现的是rv嵌套rv,然后在父rv初始化的 onCreate,初始化子rv。。如滑动卡顿里面的说明
但是实际onCreate里面没法初始化子rv

期望行为

如何复现

任何业务相关问题没有fork仓库复现问题一律无法解决, 凭空猜测只会让问题晦涩难懂, 大量耽误项目维护时间

截图

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

版本

  • BRV:
  • Android:
  • Gradle:
  • Android Studio:
@287138531 287138531 added the 寻求帮助 Extra attention is needed label Nov 22, 2022
@287138531
Copy link
Author

知道了是 if (it == R.layout.item_simple_list) {} 留给后面参考

@liangjingkanji
Copy link
Owner

liangjingkanji commented Nov 22, 2022

优化下避免歧义, onCreate/onBind现在都支持使用ViewHolder.itemViewType值, 请更新至BRV最新版本

另外ViewBinding其实也支持用于判断多类型

when (val viewBinding = getBinding<ViewBinding>()) {
    is ItemSimpleBinding -> {
        viewBinding.tvSimple.text = layoutPosition.toString()
    }
    is ItemCommentBinding -> {
        viewBinding.tvContent.text = layoutPosition.toString()
    }
}

@liangjingkanji liangjingkanji added the 提议 New feature or request label Nov 22, 2022
@liangjingkanji
Copy link
Owner

开源项目的优势在于社区力量, 欢迎共同改进维护本项目

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
寻求帮助 Extra attention is needed 提议 New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants