setOnKeyListener not responding

后端 未结 6 1085
执念已碎
执念已碎 2021-01-05 17:43

I am new to Android and working through a to do list example from a book. I have one Activity which is displaying an EditText and a ListView beneath it. There is an onKey ev

6条回答
  •  盖世英雄少女心
    2021-01-05 18:31

    Are you using the virtual keyboard? In that case the problem is that an OnKeyListener only gets called by hardware buttons. Take a look here: http://developer.android.com/reference/android/view/View.OnKeyListener.html

    The first line says: Interface definition for a callback to be invoked when a hardware key event is dispatched to this view.

    Perpaps something line this will solve your problem: Validating edittext in Android

提交回复
热议问题