Textinputlayout Hint Doesn't Float Up After Updating Google Support Library

TextInputLayout not showing EditText hint before user focus on it

Update:

This is a bug that has been fixed in version 22.2.1 of the library.

Original Answer:

As mentioned by @shkschneider, this is a known bug. Github user @ljubisa987 recently posted a Gist for a workaround:

https://gist.github.com/ljubisa987/e33cd5597da07172c55d

As noted in the comments, the workaround only works on Android Lollipop and older. It does not work on the Android M Preview.

TextInputLayout and EditText hint visible

It's a regression in v25.1.0 of the Support Design library as mentioned in a previous answer. It'll likely be fixed in a future release. Roll back to v25.0.1 for now.

https://code.google.com/p/android/issues/detail?id=230171

EDIT Fixed as of 25.2.0 apparently. Will confirm when I get chance to check.

TextInputLayout animation overlaps the text when the text is set programmatically

Currently the only way to avoid this behavior is to add the EditText programmatically.

  1. Create a TextInputLayout without the EditText. Programmatically or via XML inflation - doesn't matter, but it has to be empty.
  2. Create the EditText and set its text to whatever you need.
  3. Add the EditTExt to the TextInputLayout.

Here's an example:

TextInputLayout til = (TextInputLayout) findViewById(R.id.til);
til.setHint(R.string.hint);

EditText et = new EditText(getContext());
et.setText(value);

til.addView(et);

UPDATED 21/08/2015 WITH DESIGN LIBRARY V23:

With the design support library v23 you can disable the animation:

Just use the setHintAnimationEnabled method:

textInputLayout.setHintAnimationEnabled(boolean)

Here the issue on Google Tracker.

Disable/Remove floating label hint text in TextInputLayout XML

Starting version 23.2.0 of the Support Library you can call

setHintEnabled(false)

or putting it in your TextInputLayout xml as such :

app:hintEnabled="false"

Though the name might makes you think it removes all hints, it just removes the floating one.

Related docs and issue: http://developer.android.com/reference/android/support/design/widget/TextInputLayout.html#setHintEnabled(boolean)

https://code.google.com/p/android/issues/detail?id=181590



Related Topics



Leave a reply



Submit