Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:从视图中获取Viewgroup?_Android_View_Viewgroup - Fatal编程技术网

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