0

I have created a layout with multiple EditTexts where all of them are the same font family.

One of the EditTexts should show a quote and I had like it to have a different font than the other once I type = the hint should be same for all but once typed to change the font of this specific EditText.

Is there any way to do it?

This is how my EditText is built:

<EditText
    android:id="@+id/et_Where"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:layout_marginStart="30dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="30dp"
    android:background="@drawable/btn_underline_gray"
    android:fontFamily="@font/assistant_semibold"
    android:hint="@string/ActivityAdd_WhereHint"
    android:inputType="text"
    android:textColor="@color/colorBlackText"
    android:textSize="14sp"
    app:layout_constraintTop_toBottomOf="@+id/et_Source" />

Thank you

Ben
  • 1,737
  • 2
  • 30
  • 61

1 Answers1

0

maybe consider using TextWatcher - detect when EditText is empty or not and exchange fontFamily. some example of TextWatcher registration in HERE

be aware of known bug with loading fontFamily during runtime, it may cause memory leak. check out some workarounds in HERE

snachmsm
  • 17,866
  • 3
  • 32
  • 74