question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ExposedDropDownMenu] Changes keyboard input type even if non-editable

See original GitHub issue

Description: I have a non-editable ExposedDropDownMenu (country) and a regular TextInputLayout below it (phone), with inputType="phone". When phone input layout is focused, the keyboard is open and shows big digit keys. I tap on the country dropdown, and the keyboard remains open, but suddenly changes to regular text input type.

Expected behavior: The keyboard should hide or maybe stay in the same input type as before the click on dropdown menu.

Source code: https://gist.github.com/alaershov/e85222cdddef99b14059088247655615

Android API version: 29

Material Library version: 1.1.0, 1.2.0-alpha05

Device: Nokia 6.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
nodejsjscommented, Mar 26, 2020

Problem 1: Hide keyboard when clicked on ExposedDropDownMenu if inputType is none and is supposed to work like a non-editable dropdown menu. Solution: Just having inputType = none in xml doesn’t work. In addition to that, you need to update inputType in code too.

(input_layout_country.editText as AutoCompleteTextView).inputType = EditorInfo.TYPE_NULL

Problem 2: Hide keyboard when focus from other TextInputLayout changes to the ExposedDropDownMenu Solution: Add a view focus change listener on the dropdown menu and hide the keyboard

edit_text_country.onFocusChangeListener = View.OnFocusChangeListener { v: View?, hasFocus ->
    if (hasFocus) {
        hideKeyboard()
    }
}
3reactions
nodejsjscommented, Apr 17, 2020

Problem 1 from above comment is fixed in 1.2.0-alpha06 with MaterialAutoCompleteTextView. But the problem 2 is still there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"inputType="none" doesn't work with Material Components ...
I'm trying do make a non-editable exposed dropdown menu, following the guide under "Implementing an exposed ...
Read more >
Source Code for ExposedDropdownMenu.kt - AndroidX Tech
If the text field input is used to filter results in the menu, ... called when the exposed dropdown menu is clicked and...
Read more >
AutoCompleteTextView - Android Developers
android:textIsSelectable, Indicates that the content of a non-editable text can ... This view is invisible, but it still takes up space for layout...
Read more >
Text fields - Material Design
If any specific changes should be done when the edit text is attached (and ... TransformationMethod is still PasswordTransformationMethod. Because of
Read more >
type - Cypress Documentation
Cypress will fire input only if typing that key modifies or changes the value of the element. Event Cancellation. Cypress respects all default...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found