Skip to content

如果XML中ImageView并不是在第一层第一个所导致的崩溃问题 #49

@GitJoBo

Description

@GitJoBo

PhotoViewer的findImageView函数
private fun findImageView(group: ViewGroup): ImageView? {
for (i in 0 until group.childCount) {
return when {
group.getChildAt(i) is ImageView -> group.getChildAt(i) as ImageView
group.getChildAt(i) is ViewGroup -> findImageView(group.getChildAt(i) as ViewGroup)
else -> throw RuntimeException("未找到ImageView")
}
}
return null
}

只会判断第一个view,for循环是没用的

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