public final class ViewTree extends Object
Modifier and Type | Method and Description |
---|---|
<any> |
findChild(<any> predicate)
Find a view in the hierarchy for which the given predicate is true
|
<any> |
findChild(<any> predicate,
<any> shouldCheckChildren)
Find a view in the hierarchy for which the given predicate is true, while only check children
of nodes as directed by the additional shouldCheckChildren predicate
|
View |
getRoot() |
String |
makeString(<any> extraTextFunction)
Generates a string describing the views tree using the views' toString methods and an extra
information function.
|
static ViewTree |
of(View view) |
public static ViewTree of(View view)
public View getRoot()
public <any> findChild(<any> predicate)
predicate
- the predicate to find a view upholdingpublic <any> findChild(<any> predicate, <any> shouldCheckChildren)
predicate
- the predicate to find a view upholdingshouldCheckChildren
- a predicate to decide whether topublic String makeString(<any> extraTextFunction)
The output is a string, with each view of the tree in its own line, indented according to its depth in the tree, and then the extra information supplied by teh function.
This can be used, for example, to print all views and their respective text and is useful for when assertions fail.
extraTextFunction
- the function returning extra information to print per view, or null if
not extra information should be printed