放大嵌入在GestureFrameLayout中的TextView中的变形文本

问题描述:

当我在GestureFrameLayouthttps://github.com/alexvasilkov/GestureViews)中放大足够远的距离时,TextView中的文本变形。放大嵌入在GestureFrameLayout中的TextView中的变形文本

有没有办法解决这个显示错误? (见下文GIF)

enter image description here 以下是用于

<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> 

的XML我找到了解决问题的办法在这里。

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

这显然是一个硬件加速的错误/问题。

要解决它,我不得不在我的xml中添加android:layerType =“software”。

<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>