3

I have to get child views of WebView. For some text manipulations, I wonder if there is a way to set attributes of child views, for example:

View[] childs = webView.getChilds;
View ch = childs[0];
ch.setText("manipulated text");
Peter O.
  • 32,158
  • 14
  • 82
  • 96
Hossein POURAKBAR
  • 1,073
  • 2
  • 15
  • 33

2 Answers2

7

WebView has methods getChildCount() and getChildAt(int index). You can try to use these methods, but better solution is Bixi's one.

Martin
  • 830
  • 1
  • 7
  • 24
Agata
  • 399
  • 3
  • 6
2

Why don't you use findViewById ?

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

If you really want to iterate over the child, you can also use ViewGroup::getChildAt() and ViewGroup::getChildCount()

Jscti
  • 14,096
  • 4
  • 62
  • 87