Text won't be put in middle of textview

Viewed 47

I've only started working with android studio this month so I'm still confused about a lot of things, I'm trying to implement design from adobe xd to android studio, everything was going fine till I reached the last textview, for some reason the text stays at the edge of the button that it's supposed to be in middle of, here is the code for this textview

<TextView
        android:id="@+id/createText"
        android:layout_width="169dp"
        android:layout_height="51dp"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="16dp"

        android:layout_marginBottom="16dp"
        android:background="@drawable/coole"
        android:fontFamily="@font/aclonica"
        android:text="Sing In"
        android:textAlignment="viewStart"
        android:textColor="#FFFFFF"
        android:textSize="18sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent" />

and here is an image of what I mean: enter image description here Any help would be very appreciated, I've been trying to solve it for more than an hour and I honestly don't know what's the issue.

2 Answers

Please add

android:gravity="center"

May be you can try with

android:textAlignment="center"

enter image description here

Related