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.

[TextInputEditText] Does not detect click event

See original GitHub issue

Description: The com.google.android.material.textfield.TextInputEditText does not detect the click event when it is used to write a debug message in Logcat (or any other use of setOnClickListener)

Expected behavior: When click in a TextInputEditText, show debug message in Logcat

Source code: The layout:

<com.google.android.material.textfield.TextInputLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:hint="label">
  
  <com.google.android.material.textfield.TextInputEditText
    android:id="@+id/value"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusable="false"
    android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout>

The activity:

val value = findViewById<TextInputEditText>(R.id.value)
value.setOnClickListener  {
    Log.d("LOG", "Clicked")
}

Android API version: API 28

Material Library version: 1.2.0-alpha02

Device: Xiaomi Mi A2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wcshicommented, Dec 9, 2019

The onclicklistener is only triggered if the text field has focus (so it triggers first OnFocusChangeListener then if you click again it will trigger the click listener). If you wants to do something when the edit text is first clicked you can use a on focus changed listener instead

0reactions
francosaudicommented, Mar 1, 2021

how to bring pop up list to select item to the textInput field

Read more comments on GitHub >

github_iconTop Results From Across the Web

onClick event is not triggered on TextInputEditText android
the problem that onClick is not triggered on the first touch, it is only called when I press for the second time.
Read more >
Onclick Event Is Not Triggered On Textinputedittext ... - ADocLib
Android EditText OnClickListener not working onClick event is not triggering The onClick doesn't trigger the first time it is pressed as it should.If...
Read more >
EditText - Android Developers
android:soundEffectsEnabled, Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching.
Read more >
How to Handle IME Options on Action Button Click in Android?
This is because when we invoked the keyboard by pressing on the EditText, we saw the Done button. This is when no IME...
Read more >
Android TextInputLayout Example | DigitalOcean
Furthermore, using an EditText instead would shoot us a warning : EditText added is not a TextInputEditText. Please switch to using that ...
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