I would like to know if is there a way to call android:layout_gravity property from a Java method. I didn\'t found any method in Android documentation to do it.
android:layout_gravity
button.setBackgroundResource(R.drawable.sound_on); button.setText("On"); button.setGravity(Gravity.CENTER_VERTICAL| Gravity.RIGHT); button.invalidate();