I determine the user's location and display it in a TextInputEditText field. The hint, however, remains in the background. What am I doing wrong?
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textLayoutAutocomplete"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/standort"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/autocomplete"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
/>
</com.google.android.material.textfield.TextInputLayout>
To set the value::
binding.autocomplete.setText(place.toString())
//Also not working:
//binding.textLayoutAutocomplete.hint = ""
After setting the text, you can set the isHintEnabled
of TextInputLayout
to false
.
binding.textLayoutAutocomplete.isHintEnabled = false