Actually, I think the gravity is for more for the text of the button as Button is nothing but a text view. Anyways, I was trying to set the new custom style on a custom view at run time via constructor. (View's constructor which takes a defStyle as third parameter).
But looks like i wouldn't be able to do it unless i declare the style in xml of the custom view. (Something i'm trying to avoid). Wonder if there is any other way to set style via code (after view inflation). On Oct 23, 6:32 am, Streets Of Boston <[email protected]> wrote: > Why 'remove' the gravity style? Even if you remove it, the text in the > button needs to be drawn somewhere (probably left-aligned). > You could just set it to the value you want: > > E.g. > <item name="android:gravity">left</item> > > > > > > > > On Monday, October 22, 2012 7:59:41 PM UTC-4, Ubuntu guy wrote: > > Hello, > > > The button style has gravity specifications like center_vertical| > > center_horizontal in frameworks/base/core/res/res/values/styles.xml. > > I'm trying to override this style for a custom view to remove the > > gravity specifications but unable to do that. > > > The android:gravity item of the new styles doesn't accept > > no_gravity or 0 and just errors out. > > > Is there any way to override this button style and remove the > > default gravity specifications? > > > Thanks in advance !!! -- 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

