<TextView
android:layout_height="30dp"
android:text="@string/list_title"
android:layout_gravity="center"
android:layout_width="fill_parent"
android:textSize="@dimen/title_size"
android:textAlignment="center"
android:layout_alignParentTop="true"
android:background="@color/white"
android:id="@+id/list_title"
/>
Is the first element in a RelativeLayout :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
But the text in the TextView will not center. I cannot understand why as all gravities and the textAlignment
property are set to "center".
What am I doing wrong?
Add android:gravity="center"
to your textView