Auriwield Auriwield - 1 month ago 6
Android Question

Android Text in the Circle is not at centre

this

Why is this happening? How to fix it?
I run app on API 23 and res 2560x1440
On tablet with the same API, everything is ok

<TextView
android:id="@+id/time_view"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:background="@drawable/red_circle"
android:lineSpacingMultiplier="0.7"
android:textColor="@color/white"
android:textSize="@dimen/text_size_circle_list_view"
android:lines="2"
android:textStyle="bold"

android:layout_centerVertical="true"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:textAlignment="center"
android:text="00\n00"
android:gravity="center" />

Answer

It is the android:lineSpacingMultiplier="0.7" attribute spec that knocks it off from the center. Generally, try to remove all attributes that are not absolutely crucial to your View's look.