根据你想要的 ViewGroup 不同,你可以获取你的视图的父级并将其转换为 ViewGroup:(ViewGroup)view.getParent() // this can be done to get any level in your view hierarchy 或者您可以将视图本身转换为ViewGroup:(ViewGroup)view 基本上,在您的视图层次结构中找到所需的视图,并将其转换为ViewGroup