TextView gravity
<p>Has anyone tried to write his own implementation of ViewGroup with some TextViews in it?
I have a problem, that TextViews in such an implementation don't respect gravity attribute (TextView.setGravity(Gravity.CENTER);) and text is positioned in the top left corner.
Can anyone help me?</p>

<p><strong>EDIT:</strong></p>

<p>Ok. nevermind, I figured it already on my own.
If enyone is interested, I just overwrote method onMeasure() (for all my TextViews) and changed call from super.onMeasure() to setMeasuredDimension(int, int) and gravity started to work normally.</p>

<p>Basically, in my custom layout I use the following class to display text:</p>

<pre><code>private static class GravityTextView extends TextView {  

    public GravityTextView(Context context) {  
        super(context);  
    }  
    @Override  
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {  
        setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);  
    }  
}
</code></pre>
