TextView would not horizontally center

Posted by theGreenCabbage on Stack Overflow See other posts from Stack Overflow or by theGreenCabbage
Published on 2014-05-31T21:10:49Z Indexed on 2014/05/31 21:26 UTC
Read the original article Hit count: 193

Filed under:
|

My layout is the following:

<TextView
    android:id="@+id/display_city"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/pollenType"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/get_pollen_index"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_marginTop="51dp"
    android:textSize="40sp" />

As you can tell, Philadelphia, PA is left-aligned. No matter what I change, whether it's centering horizontal and vertical to true, it stays left-aligned.

I have tried changing the layout via the XML and graphical user interface. In the graphical user interface, it indeed is "centered", but it remains non-centered. My layout positions are consistent across all my textviews, so I am unsure as to why this particular TextView is not centered.

enter image description here

© Stack Overflow or respective owner

Related posts about android

Related posts about layout