android - TextInputLayout not showing EditText hint before user focus on it -


i using released android design support library show floating label edittexts. facing problem hint on edittext not showing when ui rendered, see hint after focus on edittexts.

my layout follows:

<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent">     <framelayout         android:layout_width="match_parent"         android:layout_height="match_parent">     <scrollview         android:id="@+id/scrollview01"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:scrollbars="vertical">          <linearlayout             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:orientation="vertical"             android:paddingleft="@dimen/activity_horizontal_margin"             android:paddingright="@dimen/activity_horizontal_margin">              <android.support.design.widget.textinputlayout                 android:id="@+id/name_et_textinputlayout"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="@dimen/activity_vertical_margin">                  <edittext                     android:id="@+id/feedbackernameet"                     android:layout_width="fill_parent"                     android:layout_height="wrap_content"                     android:hint="@string/feedbackname"                     android:inputtype="textpersonname|textcapwords" />             </android.support.design.widget.textinputlayout>              <android.support.design.widget.textinputlayout                 android:id="@+id/email_textinputlayout"                 android:layout_width="match_parent"                 android:layout_height="wrap_content">                  <edittext                     android:id="@+id/feedbackeremailet"                     android:layout_width="fill_parent"                     android:layout_height="wrap_content"                     android:hint="@string/feedbackemail"                     android:inputtype="textemailaddress" />              </android.support.design.widget.textinputlayout>              <spinner                 android:id="@+id/spinnerfeedbacktype"                 android:layout_width="fill_parent"                 android:layout_height="48dp"                 android:layout_margintop="@dimen/activity_vertical_margin"                 android:entries="@array/feedbacktypelist"                 android:prompt="@string/feedbacktype" />              <android.support.design.widget.textinputlayout                 android:id="@+id/body_textinputlayout"                 android:layout_width="match_parent"                 android:layout_height="wrap_content">                  <edittext                     android:id="@+id/edittextfeedbackbody"                     android:layout_width="fill_parent"                     android:layout_height="wrap_content"                     android:hint="@string/feedbackbody"                     android:inputtype="textmultiline|textcapsentences"                     android:lines="5" />              </android.support.design.widget.textinputlayout>              <checkbox                 android:id="@+id/checkboxfeedbackresponse"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="@dimen/activity_vertical_margin"                 android:text="@string/feedbackresponse" />              <button                 android:id="@+id/buttonsendfeedback"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="@dimen/activity_vertical_margin"                 android:text="@string/feedbackbutton" />         </linearlayout>     </scrollview>  </framelayout>  <view     android:layout_width="match_parent"     android:layout_height="5dp"     android:background="@drawable/toolbar_shadow" /> </framelayout> 

i have tried set hint textinputlayout using method sethint no luck.

mnametextinputlayout = (textinputlayout) v.findviewbyid(r.id.name_et_textinputlayout); mnametextinputlayout.seterrorenabled(true); mnametextinputlayout.sethint(feedbackernameet.gethint());  memailtextinputlayout = (textinputlayout) v.findviewbyid(r.id.email_textinputlayout); memailtextinputlayout.seterrorenabled(true); memailtextinputlayout.sethint(feedbackeremail.gethint());  mbodytextinputlayout = (textinputlayout) v.findviewbyid(r.id.body_textinputlayout); mbodytextinputlayout.seterrorenabled(true); mbodytextinputlayout.sethint(feedbackbody.gethint()); 

update:

this bug has been fixed in version 22.2.1 of library.

original answer:

as mentioned @shkschneider, known bug. github user @ljubisa987 posted gist workaround:

https://gist.github.com/ljubisa987/e33cd5597da07172c55d

as noted in comments, workaround works on android lollipop , older. not work on android m preview.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -