wrapp-archive / floatlabelededittext Goto Github PK
View Code? Open in Web Editor NEWFloating hint from edit text - inspired by Matt D. Smith's design: http://dribbble.com/shots/1254439--GIF-Mobile-Form-Interaction?list=users
Floating hint from edit text - inspired by Matt D. Smith's design: http://dribbble.com/shots/1254439--GIF-Mobile-Form-Interaction?list=users
I'm trying to add it to an existing layout programatically
private void addEditText(){
EditText itemText = new EditText(getActivity());
itemText.setHint(R.string.add_item);
itemText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
FloatLabeledEditText floatLabeledEditText = new FloatLabeledEditText(getActivity());
floatLabeledEditText.addView(itemText);
mItemParent.addView(floatLabeledEditText);
}
But I got NPE when I do that:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'float android.widget.TextView.getTextSize()' on a null object reference at com.wrapp.floatlabelededittext.FloatLabeledEditText.addView(FloatLabeledEditText.java:106)
Because setAttributes()
was not called in the public FloatLabeledEditText(Context context)
constructor. Hence, mHintTextView
was never initialized and will cause NPE when it's used in addView()
method.
Please help.
I migrated a project from Eclipse to Android Studio. In my project I'm using Android Maps utils:
compile 'com.google.maps.android:android-maps-utils:0.3+')
But when add FLET generate an AAPT error 139.
I tested creating a simple project only adding FLET and Android Maps Utils and is crashing instantly.
Unfortunately AAPT is not delivering specific details about the error.
-- Orignal in Class
addView(mHintTextView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
-- Replace With
addView(mHintTextView, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
After that user can change it from app:fletTextAppearance attribute.
I've integrated floatlabelededittext
, which works fine. But I need to change text(placeholder) and hint on a button click. As I do change the placeholder and hint on button click, hint is not changing. It shows the hint which I placed in XML layout. Is it possible to change hint from button action programmatically? If yes, can anyone please show me how?
This library is very good . but there is some issue with it, whenever one start typing in FloatLabelEditText , it's hint is not visible. after putting some letters it's float hint is still invisible . after focus changed to another FloatLabelEditText , first FloatLabelEditText hints visible.
this bug is only come whenever one is using first time FloatLabelEditText, after focus change to another FloatLabelEditText , it's working fine.
it should be like , whenever user starts typing the float label should up to edittext.
For example if we set text input type as password and background as shape.
When I open activity in first time, it looks right
When I select first editText, the hint from second editText have dissapeared
When I change focus to second field, its hint haven't appeared
That issue looks like this (#22), which you have closed
Hi,
how can I change the hint color ?
BTW : Awesome lib :)
Hello,
Today I ran into an issue with multiple dex files when I added another library (MaterialDesignLibrary) to my project which was using floatlabelededittext.
Through research I found out that the conflict is from using nineoldandroids as a dependency. I tested and saw that floatlabelededittext leads my project to add "library-2.4.0.jar" in my external libraries when gradle syncs instead of "nineoldandroids-2.4.0.jar" from the other library I'm using.
I'm suspecting that this is the cause of the conflict where dex merger cannot merge them but it still found duplicates thus generating the multiple dex error.
I use "compile 'com.wrapp.floatlabelededittext:library:0.0.5' " in the gradle of my project, but I see from the source code on this github page, this project uses "compile 'com.nineoldandroids:library:2.4.0'".
Does anyone have any idea why there are differences in jar file names?
EDIT:
Now that I test more on it, I do not think it is simply a problem of a jar file name. And I'm not that expert on gradle / android build stuff... Still no idea.
I can see in a commit that change hint color is implemented yet but, in master branch these changes are not implemented. The commit is:
https://github.com/ademar111190/floatlabelededittext/commit/4addc6ee867796d428b7aa90b759792b723c8100
Please merge it.
Thanks.
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
float:fletFloatingHint="Test"/>
The text "fletFloatingHint" needs to be changed to "floatingHint" in the sample usage code in the readme.
My code was not compiling when I had it there.
Now that I removed it, it compiles fine.
It would be pretty useful for me to set Typeface of the View or to create getter for the View's to set the Typeface on it.
When I try to write something and hide keyboard the hint not showing. Could you please fix this issue?
For example if we set text input type as password and background as shape.
Here is my code
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:layout_width="match_parent"
android:layout_height="@dimen/activity_edit_text_height"
android:layout_marginBottom="@dimen/activity_small_margin"
android:background="@drawable/edit_text_bg"
float:fletPadding="5dp">
<EditText
android:id="@+id/login_email"
android:inputType="textEmailAddress"
android:gravity="bottom"
android:layout_gravity="bottom"
android:hint="@string/your_email_address"
style="@style/ncv_edit_text_style"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditText>
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:layout_width="match_parent"
android:layout_height="@dimen/activity_edit_text_height"
android:background="@drawable/edit_text_bg"
float:fletPadding="5dp">
<EditText
android:id="@+id/login_password"
android:inputType="textPassword"
android:hint="@string/password"
android:gravity="bottom"
android:imeOptions="actionDone"
android:layout_gravity="bottom"
style="@style/ncv_edit_text_style"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditText>
style.xml <style name="ncv_edit_text_style">
match_parent
@dimen/activity_edit_text_height
@color/text_color_black
@color/text_color_black
@dimen/activity_text_size_small
@drawable/edit_text_bg
@dimen/activity_edit_text_inner_padding
@dimen/activity_edit_text_inner_padding
@dimen/activity_edit_text_inner_padding
bottom
</style>
edit_text_bg
<solid android:color="@color/ncv_edit_text_solid_color"/>
The latest version of gradle I use, whether it is implementation ("com.wrapp.floatlabelededittext:library:0.0.6")
or downloading the Float Labeled Edittext » 0.0.6 aar package from the maven warehouse and then importing it(implementation(files("D:\\AndroidStudioProject\\music\\app\\libs\\library-0.0.6.aar"))
),errors are reported.
Is it no longer supported?
Class referenced in the layout file, `com.wrapp.floatlabelededittext.FloatLabeledEditText`, was not found in the project or the libraries
Cannot resolve class com.wrapp.floatlabelededittext.FloatLabeledEditText
Here is what is happening to me:
I enter these values in their appropriate edittext's
TextView: EditText
Username: Frank
Password: frank19
And after a screen rotate I get this:
TextView: EditText
Username: frank19
Password: frank19
the onSaveInstanceState() and onRestoreInstanceState() don't seem to be functioning properly.
When I use the library project and load the floatlabeledET view in my project. My application cannot find the com.wrapp.floatlabelededittext.R compiled class.
More information here.
http://stackoverflow.com/questions/3432649/r-java-file-from-android-library-project-not-importing-into-application-project
Can we use the library without specifying the custom attribute for the floatlabeledET view?
The floating label background uses the one define in my app theme instead one the edit text one.
This gives something weird, as shown in this picture :
The red color behind email is my theme background.
I pull requested this fix, so you can merge it when you want.
I was reading over the material design spec and found a few other items that would be useful with this library.
First would be the error or below the edit underline text. A setError/setsubText type thing, essentially a label under as well as above.
Second, the hardcoded 33% transparency works well on dark and light, but I'm using in an instance with a medium dark background and there is no way to change the 33%.
Nice Lib.
I've been getting this exception with the new support library, using AS 3.0 and API 26, https://hastebin.com/utujofiyip.sql
it was working just fine before the update, any idea?
Please provide example module so that I can add this library to DevAppsDirect
i create the fletTextAppearance in style,and set textcolor,when the edittext get focus,flettext's color is right,but the textcolor is not work when lose focus.why? how to solve ?
if a Activity or fragment use floatlabelededitext , is unClose in Menory!!!, because, AnimatorProxy static field hold mHintTextView!
Useful for projects with 4.0+ support
Here is my scenario
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="@dimen/padding_xxlarge">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/padding_normal"
app:fletTextAppearance="@style/FloatLabelStyle"
app:fletPaddingBottom="@dimen/padding_normal">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_email"
android:hint="@string/email_user_name"
android:inputType="textEmailAddress"
android:imeOptions="actionNext" />
</com.wrapp.floatlabelededittext.FloatLabeledEditText>
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/padding_normal"
app:fletTextAppearance="@style/FloatLabelStyle"
app:fletPaddingBottom="@dimen/padding_normal">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txt_password"
android:hint="@string/password"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:maxLines="1"
android:singleLine="true" />
</com.wrapp.floatlabelededittext.FloatLabeledEditText>
</LinearLayout>
</ScrollView>
But when I remove fletPaddingBottom
of password section, everything works fine. So, can't we use fletPaddingBottom
in my scenario.
My device Nexus 4 running Android L.
Thanks
Every time I import your project I get this error:
Gradle 'floatlabelededittext' project refresh failed
Error:No such property: POM_ARTIFACT_ID for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
Please advise.
I'm not really sure if it's a problem or not, but I'm not be able to use actionNext properly in my xml. Here is the code I use, I tried different things but I wasn't successful.
<!-- Email TextField -->
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:id="@+id/loginEmail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/login_box_top_margin"
android:layout_marginLeft="@dimen/login_box_left_margin"
android:layout_marginRight="@dimen/login_box_right_margin"
float:fletHintTextColor="#333333"
float:fletTextColor="#000000"
float:fletFloatingHint="username"
float:fletImeOptions="actionNext"
float:fletSingleLine="true"/>
<!-- Password TextField -->
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:id="@+id/loginPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/login_box_left_margin"
android:layout_marginRight="@dimen/login_box_right_margin"
float:fletHintTextColor="#333333"
float:fletTextColor="#000000"
float:fletFloatingHint="Password"
float:fletInputType="textPassword"/>
<!-- Login Button -->
<Button
android:id="@+id/btnLogin"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginLeft="@dimen/login_box_left_margin"
android:layout_marginRight="@dimen/login_box_right_margin"
android:layout_marginBottom="@dimen/login_box_bottom_margin"
android:text="@string/loginBtnLogin"
android:textColor="#FFFFFF"/>
I will appreciate your support.
Thanks!
The label does overlap on a test device. I read somewhere that this is a known bug, which was fixed in Honycomb. However this should been fixed.
Hi,
and when I want to use login example in this template, and change its orientation,the text of both username and password will be password's text. I mean it restores the text of last control to all other controls.
How can I separate savestates of foatlabeledittexts? It restores last flet text to every other, when it changes orientation
Error:Could not get unknown property 'POM_ARTIFACT_ID' for object of type org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer.
wow,i have done .
i have add those in gradle.properties but i don't know whether it is correct or not,but it goes successfuly!
POM_NAME=Local Repository
POM_PACKAGING=aar
POM_ARTIFACT_ID=library
Add this project to Maven central so it can be easily imported into projects.
Hi,
is there any way to remove the dependence of nineoldAndroid? My project supports the api 14 upwards :/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.