I know we can set the following values to the android:gravity
and android:layout_gravity
properties:
Just thought I'd add my own explanation here - coming from a background on iOS, this is how I've internalized the two in iOS terms: "Layout Gravity" affects your position in the superview. "Gravity" affects the position of your subviews within you. Said another way, Layout Gravity positions you yourself while gravity positions your children.
Something I saw on Sandip's blog that I almost missed, fixed my problem. He said layout_gravity
DOES NOT WORK WITH LinearLayout
.
If you're using a LinearLayout
and the gravity settings are driving you nuts (like me), then switch to something else.
I actually switched to a RelativeLayout
then used layout_alignParentLeft
and layout_alignParentRight
on the 2 contained TextView
s to get them on one line to go far left and far right.