On Thu, Oct 7, 2010 at 8:27 PM, Sables <[email protected]> wrote: > I'm unable to change the layout_gravity of a Button programmatically, > does anybody know how to do this? > > The gravity attribute is easily changed using Button.gravity(), Ie it > changes the gravity of the text inside the button I cannot change the > gravity of the button itself.
Try: LinearLayout.LayoutParams lllp=(LinearLayout.LayoutParams)myButton.getLayoutParams(); lllp.gravity=Gravity.RIGHT; myButton.setLayoutParams(lllp); > I also cannot seem to find this in any of the layout params > contructors. Correct. It's only available as a public data member. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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

