0

I have a Toast that shows up while the user is typing in an EditText widget however it hides under the SoftKeyboard and cannot be seen unless the user hits backbutton to remove the keyboard.

Is there a way to make the Toast show anyways?.

Omar Boshra
  • 447
  • 7
  • 21
  • You may not be able to force the Toast to appear above the keyboard (in z-coordinates), but you can set its x and y coordinates so it will not be covered by the keyboard: see the accepted answer plus comments to [How to position a Toast ...](https://stackoverflow.com/a/40022425/5015207) – Bö macht Blau Sep 21 '17 at 17:39
  • 1
    Have the toast show up top portion of the screen, example: `toastVariable.setGravity(Gravity.TOP|Gravity.LEFT, 0, 0);` – Si8 Sep 21 '17 at 17:55
  • I guess I'have to just do this instead .However it was more optimal for me to overlap it in the z-coordinate. – Omar Boshra Sep 21 '17 at 17:58

1 Answers1

0

Well overriding that behavior would take some hacking and I think not a preferred solution to take over the placement of the toast. Some phones will toast over the keyboard and others toast above. I hate when they toast over the keyboard as it blocks my typing personally.

However, if you want full control of your toast you can use a custom library like: https://android-arsenal.com/details/1/6209

But I prefer to use Snackbar as it looks nicer, and stays at the bottom for you and can handle a single button if desired.

Sam
  • 5,342
  • 1
  • 23
  • 39