What is the use of "android:hintAnimationEnabled" in TextInputLayout? - android

1.What is the use of android:hintAnimationEnabled in TextInputLayout?
2.What is the difference between android:hintAnimationEnabled and android:hintEnabled?

1.What is the use of android:hintAnimationEnabled in TextInputLayout?
When you click (focus) on an empty EditText with hint, the hint text animates and slides upwards. android:hintAnimationEnabled allows you to enable or disable this animation.
Check the image below:
2.What is the difference between android:hintAnimationEnabled and android:hintEnabled?
android:hintEnabled was added in design library 23.2.0.
android:hintEnabled="true" (Enabled) : Shows the hint floating on the top of EditText when focused or when having text set into the EditText
android:hintEnabled="false" (Disabled) : Doesn't show the hint floating on top of EditText, it means, the hint is visible at the same place when empty EditText is focussed and vanishes off as soon as the first character is entered.
In short, android:hintAnimationEnabled enables/disables the hint animation while android:hintEnabled enables/disables the floating behaviour of hint.

Have a look at this. It has a clear view of TextInputLayout hintAnimation
https://www.journaldev.com/14748/android-textinputlayout-example
UPDATE
When you set a hint in TextInputLayout is shows as like as a normal textView Hint. But when user click on EditText the hint slide and goes little upwards.
And , if you disable hint animation, then it won't show any animation for hint text.

I'll give you a hint ;)
Animation is a different property than the Hint text being there at all
In other words, you can't animate something that's disabled. But you don't need animation to show the value
You're welcome to read what the difference is. https://developer.android.com/reference/android/support/design/widget/TextInputLayout.html

Related

How to add accessibility focus on an Edit Text drawable right (Talkback)

I have an editText that contains a drawableRight property. This editText is a search field, and the drawableRight is an "x" icon for clearing the text from the search field. When using Talkback (screen reader), I can't select the drawableRight to trigger my onTouch() event as it thinks I'm trying to tap on the editText as a whole.
I've tried to use .sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED) on my editText drawable, but accessibility functions can only be used on elements that inherit from View.
When I try to access the drawable like this editText.getCompoundDrawables()[4] it doesn't give me any accessibility options, as it does not inherit from View.
I need to find a way to let people with disabilities be able to tap on the "x" drawable from my edit text to clear the search bar text.

How to highlight textinputlayout on focus without bringing the keypad up

I am trying to design a control of TextInputLayout, on click of which a pop up will appear to select item. I want to highlight this TextInputLayout when clicked that means showing floating label but don't want to show the keypad of edit text.
Please note: I am using TextInputLayout Edit text because i want the look of floating label when an item is selected.
Thank you

How to set multiple colors to a floating Edittext's hint?

Is there a way to set multiple colors to the edittext's hint when wrapped by android.support.design.widget.TextInputLayout without compromising the behaviour of floating edittexts?
AFAIK The only way to set multiple colors to the edittext hint is by using SpannableStringBuilder. But when the editext is wrapped by TextInputLayout and the hint set programmatically using a SpannableStringBuilder, it behaves like a normal editext which does not float (the labels aren't floating)
Whereas if the hint is set through the xml it works as a floating edittext but in this case the hint would be single colored
I am looking for a way to add multiple colors to the edittext while the floating labels work intact.

How to prevent EditText error icon from being pushed by padding?

I am using the setError method of the EditText view. The problem is, I want the EditText text to only be filled up to a certain point, so I need to put a padding on it's right side. But then the error icon is also pushed by the padding. Is there any way to prevent this?
It turns out there's no workaround for this. I just changed the logic of my custom edittext to add padding ONLY if the error icon is not shown

Android: How to do create custom EditText with a clickable arrow on the right

I would like to have an EditText with one modification: on the right but still inside the EditText there should an arrow pointing downwards that I can set OnClickListener to so that when the user clicks on the arrow it displays a menu.
What is the best way to do this?
Do you mean something like this ?
see image
Add the arrow by setting the drawable right attribute
android:drawableRight="#drawable/right"
to your EditText. Then you would need to set an OnTouchListener to get the events.
I did this by putting EditText and a Button into RelativeLayout, the Button (which has custom background drawable) is overlapping the EditBox.
When user clicks on it, the EditBox doesn't receive the click event.
Sounds like a combo box. If you look at the "Building Custom Components" section of the Dev Guide, they mention combo box briefly, but give details on how to build any custom component.

Categories

Resources