Currently, I use TextInputLayout (See) which the hint can float to the top when control is focused. It works well but I cannot setHint to it programmatically when I click on a button.
Here is what I did.
editText1.setHint("Input username");
This is my xml code
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="20dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/user_field"
android:hint="Enter your User-ID or username"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
This is control before click button.
After click button
It should change the small red text to Input username.
Thank for any helps.