I am getting a list of strings from server and should be shown as Hints of TextInputLayout
. Everything is working fine, I am getting list of strings from server and based upon the list size I am able to show that many number of views and string values as hint.
The problem I am facing is when they are getting focus, the hint doesn't animate as expected. They looks like a normal EditText
.
Below is my code:
layout_input.xml
<android.support.design.widget.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/inputAttr"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
MyViewHolder.kt
internal class InputAttributeHolder(item: View) : RecyclerView.ViewHolder(item) {
private val attrName: TextInputEditText = item.inputAttr
fun bind(attr: Attribute) {
attrName.hint = attr.name
}
}
NOTE: The hint is set dynamically in ViewHolder while binding, not statically in XML. When I am setting it in XML, it's working fine. But dynamically setting hint doesn't animate.
use EditText inside android.support.design.widget.TextInputLayout