Initially, the edittext
should be shown like this.
Initial EditText
After clicking on edittext
, Hint should float to bottom like this -
Required Output
Please help me out in this.
Initially, the edittext
should be shown like this.
Initial EditText
After clicking on edittext
, Hint should float to bottom like this -
Required Output
Please help me out in this.
You can use any one of the below two methods, but this will float to top on click of hint -
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText..../>
</android.support.design.widget.TextInputLayout>
Or
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:hintTextAppearance="@style/TextLabel"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:width="100dp"
android:hint="HInt Here"
android:inputType="text"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
/>
</android.support.design.widget.TextInputLayout>
Add style to style.xml
<style name="TextLabel" parent="TextAppearance.Design.Hint">
<item name="android:textSize">11sp</item>
<item name="android:textColor">#929292</item>
<item name="android:textColorHint">#929292</item>
<item name="android:color">#929292</item>
<item name="android:gravity">bottom</item>
</style>