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.
- Create a
TextInputLayout
without theEditText
. Programmatically or via XML inflation - doesn't matter, but it has to be empty. - Create the
EditText
and set its text to whatever you need. - Add the
EditTExt
to theTextInputLayout
.
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
Download Images Using Android Webview
JSONarray Cannot Be Converted to JSONobject Error
How to Get Activity in Compose
Android/iOS - Custom Uri/Protocol Handling
Arrayindexoutofboundsexception with Custom Android Adapter for Multiple Views in Listview
Get Font Scaling Factor to Calculate the Fontsize
How Do Popular Apps Authenticate User Requests from Their Mobile App to Their Server
Google Maps V2 - Set Both My Location and Zoom In
Android: Save File Permanently (Even After Clear Data/Uninstall)
Is There a Faster Way to Decode HTML Characters to a String Than HTML.Fromhtml()
Insufficent_Storage_Memory Message While Install 50 Mb APK in Emulator
Android: Create a Toggle Button with Image and No Text
Get Meta Data of Image - Android
Running Google Map Application on Android Emulator
Change Chip Widget Style Programmatically Not Working - Android