如何在Android中获取视图组的子视图?

如何在Android中获取视图组的子视图?,android,view,android-webview,viewgroup,Android,View,Android Webview,Viewgroup,我必须获得WebView的子视图。对于某些文本操作,我想知道是否有一种方法可以设置子视图的属性,例如: View[] childs = webView.getChilds; View ch = childs[0]; ch.setText("manipulated text"); 为什么不使用findViewById TextView subElement = (TextView) webview.findViewById(R.id.subelement); subElement.setText

我必须获得WebView的子视图。对于某些文本操作,我想知道是否有一种方法可以设置子视图的属性,例如:

View[] childs = webView.getChilds;
View ch = childs[0];
ch.setText("manipulated text");

为什么不使用findViewById

TextView subElement = (TextView) webview.findViewById(R.id.subelement);
subElement.setText("Oh Hi");

如果您确实想在子对象上进行迭代,还可以使用和

WebView具有方法
getChildCount()
getChildAt(int index)
。您可以尝试使用这些方法,但更好的解决方案是Bixi的方法。

我不知道内部视图,您可以编写一些应用代码吗?谢谢。如果您需要代码示例,请参阅我的帖子:我强烈建议您阅读Android培训页面:因为这是一些非常基本的Android方法FindViewById()对资源要求很高