Skip to content

同一类型的多个 fragment 实例的 binding.view 引用错位问题 #36

@DQSecret

Description

@DQSecret

代码结构:
Activity -> 上下两个 Fragment (同一个类型的,2个实例)

具体使用:

class ImageAdFragment : AdFragment(R.layout.fragment_image_ad) {

    private val binding by viewbind<FragmentImageAdBinding>()

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        Utils.log("加载图片${model.url}")
        Glide.with(binding.ivImg.context).asBitmap().load(File(model.url)).into(binding.ivImg)
    }
}

导致第二个 fragment 的图片,展示到了第一个 fragment 里的 ImageView 上,
然后,第二个 Fragment 显示空白...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions