You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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循环是没用的
The text was updated successfully, but these errors were encountered:
这是修复后可用的函数
private fun findImageView(group: ViewGroup): ImageView? {
for (i in 0 until group.childCount) {
val child = group.getChildAt(i)
if (child is ImageView) {
return child
} else if (child is ViewGroup) {
val result = findImageView(child)
if (result != null) {
return result
}
}
}
throw RuntimeException("未找到ImageView")
}
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循环是没用的
The text was updated successfully, but these errors were encountered: