Search code examples
androidxmlandroid-edittext

Text in edit text not vertically aligned in android


enter image description here

here's screen I talk about, look at the two orange edit text they are looking so weird cause the text itself which is 2 and 30 isn't vertically aligned and as you see there's no padding or anything abnormal in my xml, I tried to make gravity vertically aligned but it didn't work, so what should I do to make it vertically aligned

<EditText
        android:id="@+id/input_edit_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:background="@drawable/rectangle_border"
        android:ems="3"
        android:gravity="center"
        android:inputType="number"
        android:textStyle="bold"
        android:textAppearance="@style/Body2"
        android:textColor="@android:color/white"
        app:backgroundTint="@color/colorAccent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/title_text_view" />

Solution

  • Tried to remove your Edittext textAppearance android:textAppearance="@style/Body2"