use setGravity() instead of setting it directly