Skip to content

Instantly share code, notes, and snippets.

@alaershov
Last active March 25, 2020 07:14
Show Gist options
  • Save alaershov/e85222cdddef99b14059088247655615 to your computer and use it in GitHub Desktop.
Save alaershov/e85222cdddef99b14059088247655615 to your computer and use it in GitHub Desktop.
ExposedDropdownMenu input type bug sample
val adapter = ArrayAdapter(
requireContext(),
R.layout.item_dropdown_country,
countryList // List<String>
)
binding.editTextCountry.setAdapter(adapter)
binding.editTextCountry.onItemClickListener = AdapterView.OnItemClickListener { parent, view, position, id ->
binding.editTextPhone.requestFocus()
}
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_country"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/enter_phone_hint_country">
<AutoCompleteTextView
android:id="@+id/edit_text_country"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:editable="false" // any combinations of editable and inputType attributes lead to the same result
android:inputType="none"
tools:ignore="Deprecated,LabelFor"
tools:text="Россия" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_phone"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/enter_phone_hint_phone">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" />
</com.google.android.material.textfield.TextInputLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment