Manter a cor do Hint

Android

XML

11/01/2018

O hint é azul(Nova Assinatura), mas quando você seleciona o campo o hint muda a cor para cinza(Confirme Ass.). Assim que muda de campo o hint não deve voltar a ficar azul (Como o hint voltou a ficar azul na Ass. Provisória) e sim continuar cinza.

public class EditTextValidation extends FrameLayout

public void setHint(String hint) {
textInputLayout.setHint(hint);
textInputLayout.setContentDescription(hint);
// textInputLayout.setHintTextAppearance(R.style.AppTheme_TextFloatLabelAppearance);
textInputEditText.setHintTextColor(Color.GRAY);
styles.xml

<style name="TextInputLayoutValidation">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColorHint">@color/azul_texto</item>
<item name="hintTextAppearance">@style/AppTheme.TextFloatLabelAppearance</item>
<item name="errorTextAppearance">@style/AppTheme.TextErrorAppearance</item>
</style>

<style name="AppTheme.TextFloatLabelAppearance" parent="TextAppearance.Design.Hint">
<!-- Floating label appearance here -->
<item name="android:textColor">@color/cinza_texto</item>
<item name="android:textSize">14sp</item>
</style>

<style name="TextInputEditTextValidation" parent="AppTheme.Full.Light">
<item name="android:textSize">16sp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">56dp</item>
<item name="android:paddingRight">40dp</item>
<item name="android:singleLine">true</item>
<item name="android:textCursorDrawable">@null</item>
<item name="android:textColorHint">@color/cinza_texto</item>
<item name="android:textColor">@color/azul_texto</item>
</style>
view_edit_text_validation.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayout"
style="@style/TextInputLayoutValidation">

<android.support.design.widget.TextInputEditText
android:id="@+id/textInputEditText"
style="@style/TextInputEditTextValidation"
android:textColorHint="@color/cinza_texto"
android:inputType="textNoSuggestions|textVisiblePassword"
tools:hint="Nome de usuario" />

</android.support.design.widget.TextInputLayout>
Cristiano Pinheiro

Cristiano Pinheiro

Curtidas 0

Respostas

Cristiano Pinheiro

Cristiano Pinheiro

11/01/2018

Imagem para entendimento.

https://cdn.pbrd.co/images/H2t5ors.png
GOSTEI 0
POSTAR