2017-08-23 12 views
0

Les textes dans TextView sont déformés lorsque je zoom avant assez dans un GestureFrameLayout (https://github.com/alexvasilkov/GestureViews).Le zoom avant déforme le texte dans TextView incorporé dans GestureFrameLayout

Y at-il un moyen de corriger ce bug d'affichage? (Voir ci-dessous gif)

enter image description here Ce qui suit est le XML utilisé

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

Répondre

0

J'ai trouvé la solution au problème.

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

c'est apparemment un bug d'accélération matérielle/question. Pour résoudre ce problème, j'ai dû ajouter android: layerType = "software" dans mon fichier 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>