private int dpToPx(int dp) {
    Resources resources = mView.getContext().getResources();
    return (int)
        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
  }
Some views (e.g. SimpleVariableTextLayoutView) in FB4A rely on the predraw. Actually I don't
know why, ideally it shouldn't.

<p>However if you find that text is not showing in your layout, try dispatching the pre draw
using this method. Note this method is only supported for views that are not attached to a
Window, and the behavior is slightly different than views attached to a window. (Views attached
to a window have a single ViewTreeObserver for all child views, whereas for unattached views,
each child has its own ViewTreeObserver.)
core/src/main/java/com/facebook/testing/screenshot/ViewHelpers.java