2

I have an Android app with a touch listener that detects touch events to my app. This works fine for areas within my app, but when the on screen keyboard is activated that the user touches it, I don't get these touch events. Is it possible to obtain these touch events as well?

On a related note, what type of View element are on screen keyboards? Are they system overlays?

user1118764
  • 9,255
  • 18
  • 61
  • 113

1 Answers1

-1

You can use

android:windowSoftInputMode="adjustPan" 

or

android:windowSoftInputMode="adjustResize" 

It will move your layout above the keyboard or resize it respectively.

Hope it helps.

Sarthak Gandhi
  • 2,130
  • 1
  • 16
  • 23
  • I'm not exactly sure what this does, but I tried including the 2 lines (adjustPan and then adjustResize) in my in the manifest, and the behavior did not change. Touch events within my app, on the top half of the screen (above the keyboard) trigger my onTouchListener, but touch events on the keyboard don't. – user1118764 May 30 '17 at 03:54
  • the keyboard has its own touch listener which you cannot ovverride. Can you tell me exact purpose for which you need this? – Sarthak Gandhi May 30 '17 at 04:00
  • I wish to guard against the invisible grid overlay attack that logs key inputs above the on-screen keyboard. By detecting if the MotionEvent is obscured, I can detect this if the touch event occurs within my app, but not if the touch is within the on-screen keyboard. – user1118764 May 30 '17 at 06:04