Android:从视图中获取Viewgroup?
有没有办法从视图中获取视图组?我正在尝试创建一个自定义阵列适配器,它需要查看组取决于您要查看的Android:从视图中获取Viewgroup?,android,view,viewgroup,Android,View,Viewgroup,有没有办法从视图中获取视图组?我正在尝试创建一个自定义阵列适配器,它需要查看组取决于您要查看的查看组,您可以获取视图的父视图并将其强制转换为查看组: (ViewGroup)view.getParent() // this can be done to get any level in your view hierarchy (ViewGroup)view 或者可以将视图本身强制转换为视图组: (ViewGroup)view.getParent() // this can be done t
查看组,您可以获取视图的父视图并将其强制转换为查看组:
(ViewGroup)view.getParent() // this can be done to get any level in your view hierarchy
(ViewGroup)view
或者可以将视图本身强制转换为视图组
:
(ViewGroup)view.getParent() // this can be done to get any level in your view hierarchy
(ViewGroup)view
基本上,在视图层次结构中找到所需的视图,并将其强制转换为ViewGroup