I want to dynamically set the hint of an AppCompatAutoCompleteTextView from the java code, and moving on top when writing like at the following image:
The issue is that when I am setting the from the xml (static) everything works fine:
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
android:id="@+id/myid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:imeOptions="actionDone"
android:singleLine="true" />
but when I remove the hint from the xml and add it from the java code:
final AutoCompleteTextView companyAutocomplete = findViewById(R.id.myid);
companyAutocomplete.setHint("new hint");
the hint is not moving on top when start writing.
Could you help me understand what i am missing? Thanks