weddingparty / AndroidFloatLabel

Float Label Edit Texts for Android
Apache License 2.0
425 stars 49 forks source link

Allow styling of EditText and TextView through xml #4

Closed alopix closed 4 years ago

alopix commented 10 years ago

It would be nice to be able to set a style for the embedded EditText (as well as TextView) in the xml.

I would also suggest using FrameLayout instead of LinearLayout to have the Label in front of the EditText. The reason is styling the EditText background. Don't know if you had a reason (except the parent LinearLayout) to order them like that.

kaushikgopal commented 10 years ago

able to set a style for the embedded EditText (as well as TextView) in the xml. Hmm. I've thought about this but I have a (possibly unwarranted) looming concern that it'll make the code more messy. The hope is to keep this library dead simple and clean.

You have a handle to the EditText, so that should allow styling programmatically (if someone really feels the need). Currently we set the height as a factor of the EditText. Allowing styles might add the need for more guard clauses on style, so it doesn't overlap etc.

using FrameLayout instead of LinearLayout

I actually started out with a FrameLayout. I changed it to LinearLayout because the height calculations are handled by the core view. If it were a frame layout, then we would need to do more calculations to get the height correct. Also it's not as easy as setting a height, because the height of the EditText and hint would only be available to us on render. So we would need to add an observer etc.

That was the reason that a LinearLayout was originally used. I'm totally cool with changing this to a FrameLayout, though the only limiting factor is time :) (wink wink: pull requests welcome)

alopix commented 10 years ago

chrisbanes has a great implementation using a FrameLayout and better customization. Maybe you can include some improvements from it – I would prefer a good OS library instead of copying a class to every project ;)

kaushikgopal commented 10 years ago

yeah i noticed that gist and really like the implementation. Will definitely look into improving our implementation.

walmyrcarvalho commented 10 years ago

@kaushikgopal Great! I was ready to port the code for a pull request, but it could be a huge change for the lib. Looking forward to it.

alopix commented 4 years ago

Does not look like this is still being worked on 🤷🏻‍♂️