I am building an app that has some AutoCompleteTextView
, using amterial design AppCompat
. I need to remove the hint animation that this component has, when you tap on the field and the hint goes up, in a smooth animation. Is there any way to remove this animation?
My layout:
<!-- Login progress -->
<ProgressBar android:id="@+id/login_progress" style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:visibility="gone" />
<LinearLayout android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:id="@+id/email_login_form" android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical">
<android.support.design.widget.TextInputLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView android:id="@+id/email" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true"
android:theme="@style/AutoCompleteTextViewListasVipHolo" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="@+id/password" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="@string/prompt_password"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified" android:inputType="textPassword"
android:maxLines="1" android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<Button android:id="@+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/action_sign_in"
android:textStyle="bold" />
<Button android:id="@+id/register_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/action_register"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
I don´t want to lose the auto complete feature.
If you want to remove the floating label, then remove the TextInputLayout
wrapping around your AutoCompleteTextView
. This will remove the floating label feature.
If you want the floating label, but disable the animation, then with the support design library v23 you can use textInputLayout.setHintAnimationEnabled(false);
in your code
or app:hintAnimationEnabled="true"
as a parameter to the TextInputLayout
in XML.
It can be done programmatically very easily by doing the steps below.
textInputLayout.setHint(null);
EditText editText = textInputLayout.getEditText();
editText.setHint("your hint text");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With