Shared publicly  - 
 
Decided to spend the evening updating my floating label implementation, FloatLabelLayout, to match the Material Design spec[0].

The text growing/shrinking animation needs a bit more work but it's mostly there. I've also started using ViewCompat#animate() so that we're backwards compatible back to API v4 (although the animation will only work in API 14+).

You can find the source on GitHub: https://gist.github.com/chrisbanes/11247418

#AndroidDev   #MaterialDesign

[0]: http://www.google.com/design/spec/components/text-fields.html#text-fields-floating-labels
430
161
Audiebant Zhan's profile photoEduardo Naveda (Edd)'s profile photoPablo Costa Tirado (Sotti)'s profile photoLinda Tovar's profile photo
26 comments
 
I think you could animate the TextColor from label to hint and vice-versa...
 
Nice work. Your currently blitzing the font sprite atlas during the label animation. You can improve the resizing performance, would help on lower end devices. On the train home, but when I get in I'll fork the gist and show you what I'm on about. 
 
+Lucio Maciel Yep, good idea.
+Simon Lightfoot Yep, I will bring in some stuff from my CollapsingToolbarLayout text handling when I get a chance. This was a quick-and-easy way for now.
 
+Lucio Maciel Yeah, once you see it switch to green before starting the animation you cannot unsee :(
 
+Chris Banes​ maybe this is the opportunity to put slidingTabsLayout sample's "blendcolors" method into palette's ColorUtils... And make it api-public?
 
I wonder if you can take advantage of (Paint.LINEAR_TEXT_FLAG | Paint.SUBPIXEL_TEXT_FLAG) flag combination on pre-HC devices.
 
What about the error and warning implementation that can be seen in the Material Design spec. I saw some people already implemented it but I think it should be built in AppCompat EditText 
 
thank you .... You know , You are Hero of Many Guys like me
 
+Chris Banes​ very cool! Would you still see the edittext hint in landscape IME fullscreen edit mode, when the label is not shown?
 
Was looking for this... thanks :)
 
This is AWESOME!!!! I love it!!!

I have to say, the whole content of Material Design concept is brilliant. A big leap of Android User Experience. As an Android developer, I'm really proud of involving in it.
 
I'm trying to figure out what's my problem with this. I pretty much copy paste the code and the animation is not smooth at the end when the label transforms into the hint. There's like a jump.

In other words, the position of the hint and the label is different when it's supposed to be the same.

Anyone having this problem??

PD: Looks like it is a padding problem.
 
Hola, para cambiar el color de la etiqueta flotante es decir donde se va a escribir el texto?? Como se haria?? 
Translate
Add a comment...