1

How can I set layout_gravity programmatically?

I need to set position of a button LEFT or CENTER or RIGHT in a particular layout, I used the myButton.setGravity(Gravity.LEFT); but, it sets the gravity of button's text.

j0k
  • 22,600
  • 28
  • 79
  • 90
user1703737
  • 533
  • 1
  • 11
  • 25

1 Answers1

0

I found this by putting your title in the search bar. The short version: Use LayoutParams

Community
  • 1
  • 1
keyser
  • 18,829
  • 16
  • 59
  • 101