Android: Alignment text in button using setGravity()
<p>I wolud like to set button's gravity value from default <code>center</code> to <code>right</code> using <code>TextView.setGravity()</code> method, but when I call it nothing happens. In LogCat output using <code>getGravity()</code> method I still see the first value - 17 (<code>center</code>). </p>

<p>Tell me please, how can I change button's gravity value, using <code>setGravity()</code> method?</p>

<p>Here is code snippet which describes setting the view's gravity:</p>

<pre><code>public void setGravity(String gravitation) {
        if(controlledView != null) {
            String gravityValues[] = gravitation.split("|");
            for(String gravity : gravityValues) {
                if(gravity.equals("center")) {
                    controlledView.setGravity(Gravity.CENTER);
                }
                else if(gravity.equals("top")) {
                    controlledView.setGravity(Gravity.TOP);
                }
                else if(gravity.equals("bottom")) {
                    controlledView.setGravity(Gravity.BOTTOM);
                }
                else if(gravity.equals("right")) {
                    controlledView.setGravity(Gravity.RIGHT);
                }
                else if(gravity.equals("left")) {
                    controlledView.setGravity(Gravity.LEFT);
                }
            }
        }
}
</code></pre>

<p>where <code>controlledView</code> is instance of <code>Button</code> class.</p>
