Can someone tell me why is the text in this layout is centered horizontally while in landscape mode, but becomes left-aligned in portrait mode?
EDIT:
Its that way because there’s no pixel limit specified for text width (ie 500dip). So if its wrap_content, android simply flows the text across all of available space. I guess its a “correct” behaviour for a text component, but completely unwanted.
<LinearLayout android:id="@+id/progressLayout2"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerVertical="true"
android:orientation="vertical">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_centerHorizontal="true"
android:layout_centerVertical="true" android:text="@string/splash_text"
android:id="@+id/heading_splash_text" android:textSize="45dip"
android:textColor="#A00000" android:layout_alignParentTop="true"
android:layout_gravity="center" android:paddingBottom="70dip"
android:paddingTop="50dip" android:typeface="normal" android:textStyle="bold"/>
</LinearLayout>
I agree with some of the changes from the first answer, but I assume since you have ‘wrap_content’ on the linear layout, and you don’t have the namespace thing on there, this layout is inside some other stuff.
First, you pretty much need the ‘fill_parent’ width, even if you don’t do height. Where the gravity should be specified is generally confusing, but the following works. I added a background color on the text so you can see where that is relative to everything else.
Add back in padding if needed.