Android - Get keyboard key press

后端 未结 4 1781
独厮守ぢ
独厮守ぢ 2020-12-08 05:00

I want to catch the press of any key of the softkeyboard. I don\'t want a EditView or TextView in my Activity, the event must be handled from a extended View inside my Activ

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 05:13

    When Keyboard is opened in activity your activity actually becomes foreground... All TextArea or TextFields have their own mechanism to get keypressed from onScreen keyboard... if you want to use onKeyDown() listner for virtual keyboard make sure that you set in AndroidManifest File under your activity android:windowSoftInputMode="stateAlwaysVisible" then onkeyDown() will work it did worked for me ...

提交回复
热议问题