This is different gravity, without the "layout_" part.

Layout options are specified in the parent layout of the view in question, not in the view itself.

http://developer.android.com/reference/android/view/View.html#setLayoutParams(android.view.ViewGroup.LayoutParams)

The LayoutParams object needs to be of a class that matches the layout.

Use LinearLayout.LayoutParams, RelativeLayout.LayoutParams, etc., depending on what the parent layout obejct is.

-- Kostya

06.10.2010 23:15, Kumar Bibek ?????:
Every widget has a method called setGravity.
http://developer.android.com/reference/android/widget/TextView.html#setGravity%28int%29

On Thu, Oct 7, 2010 at 12:42 AM, Sables <[email protected] <mailto:[email protected]>> wrote:

    Hi,
    I can't seem to find anywhere a way to programmatically change the the
    alignment of the button.

    In the XML it is simply  layout_gravity="Center" or something.

    How do we do this in the code?

    LayoutParams do not seem to cater for this.

    --
    You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en




--
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to