0

Texts in TextView gets deformed when I zoom in far enough in a GestureFrameLayout (https://github.com/alexvasilkov/GestureViews).

Is there a way to fix this display bug? (see gif below)

enter image description here The following is the XML used

<com.alexvasilkov.gestures.views.GestureFrameLayout
    android:id="@+id/ll_gesture"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_gravity="center"
    android:gravity="center"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/font_name">

    <TextView
        android:id="@+id/tv_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/black"
        android:textSize="40sp" />

</com.alexvasilkov.gestures.views.GestureFrameLayout>
Angel Koh
  • 12,479
  • 7
  • 64
  • 91

1 Answers1

0

I found the solution to the problem here.

https://stackoverflow.com/a/12371794/908821

this is apparently a hardware acceleration bug/issue.

to resolve it, i had to add android:layerType="software" in my xml.

<com.alexvasilkov.gestures.views.GestureFrameLayout
        android:id="@+id/ll_gesture"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_gravity="center"
        android:gravity="center"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/font_name">

        <TextView
            android:id="@+id/tv_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/black"
            android:layerType="software"
            android:textSize="40sp" />

</com.alexvasilkov.gestures.views.GestureFrameLayout>
Angel Koh
  • 12,479
  • 7
  • 64
  • 91