Someone tried to change the font of the floating label? I changed the source of EditText but the font of the floating label did not change, I am very grateful to those who help me
Code:
<android.support.design.widget.TextInputLayout
android:id="@+id/tilTextoDescricao"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tilValorUnidade"
android:layout_marginTop="10dp">
<EditText
android:id="@+id/etTextoDescricao"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:hint="Descrição"
android:textSize="15dp"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
-----------------
etTextoDescricao= (EditText) findViewById(R.id.etTextoDescricao);
etTextoDescricao.setTypeface(CustomTypeface.getTypefaceMediumDefault(this));
Unfortunately, you'll have to use reflection to handle this.
The floating label is drawn by
CollapsingTextHelper
, which is an internal, package-private class and isn't setup to handle spans. So, using something like a customTypefaceSpan
won't work in this case.Because this uses reflection, it isn't guaranteed to work in the future.
Implementation
Error view
If you needed to change the font of the error, you could do one of two things:
TextView
and apply theTypeface
much like beforeTextInputLayout
is just aTextView
, so it's able to handle spans.Using reflection
Using a custom span
Results
The font I'm using is Smoothie Shoppe.