fun <T : View> ViewGroup.whereMyView(viewId: Int): T? {
//if ViewGroup's 'Id' is same as 'viewId' return ViewGroup
if (this.id == viewId) return this as? T
for (i in 0 until childCount) {
val child = getChildAt(i)
if (child.id == viewId) return child as? T
if (child is ViewGroup) {
val foundView: T? = child.whereMyView(viewId)
if (foundView != null) return foundView
}
}
return null
}
-
Notifications
You must be signed in to change notification settings - Fork 0
thesurajkamble/FindViewByIdCustom
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
A simple implementation of findviewbyId
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published