title: Custom layout and gravity of TextView (horizontal gravity works but vertical fails)
body: <p>We have encountered a problem with the following <code>View</code>. The <code>TextView</code>'s gravity should center its text horizontally and vertically, but the text is just centered horizontally and sticks at the top. What's wrong?</p>
  
  <pre><code>public class TestLayout extends ViewGroup {
      private TextView textView;
  
      public TestLayout(Context context, AttributeSet attrs) {
          super(context, attrs);
  
          textView = new TextView(context);
          textView.setText("Hello world.");
          textView.setGravity(Gravity.CENTER);
          addView(textView);
      }
      @Override
      protected void onLayout(boolean changed, int l, int t, int r, int b) {
          textView.layout(0, 0, r - l, b - t);
      }   
  }
  </code></pre>