Repository navigation
Showing Android IME without visual glitches? #3445
|
I made a very simple app for android that draws a few lines in different colors on the screen and shows/hides the IME when clicking on the screen: https://github.com/tinne26/imeglitch When the IME is requested to show (from the UI thread) on Java, the layout in Ebitengine changes for a moment (due to the insets, understandable), but there's some unusual visual flicker / glitching. Here's a video for context, and a separate image later to appreciate that the visual glitch is not just poorly handled layout or anything on the basic game code (video taken on Android 14). 20260504_105540_2.mp4Here's a still of the exact moment where the glitch happens, where we can see that it's not a lack of clearing, stretching or anything else, but rather a pattern appearing repeated. This actually happens during multiple frames, though it's still very quick. Since this looks like some internal rendering issue, but before opening an issue, I wonder... has anyone managed to show/hide IMEs on Android without visual glitches? |
Replies: 2 comments 2 replies
|
Unfortunately I don't have good insights this issue.
Isn't the keyboard overlay? Why is the widget size changed? |
|
The flicker is caused by the activity being resized when the IME changes the window insets. The simplest way to avoid that is to tell Android not to resize the window when the keyboard appears. Add (or change) the windowSoftInputMode flag in your <activity
android:name=".MainActivity"
android:label="@string/app_name"
android:exported="true"
android:windowSoftInputMode="stateHidden|adjustPan">
<!-- … -->
</activity>
|

The flicker is caused by the activity being resized when the IME changes the window insets.
When the view is resized Ebiten recreates the native surface, which shows the old frame for a couple of V‑syncs and produces the “repeated‑pattern” artifact you see.
The simplest way to avoid that is to tell Android not to resize the window when the keyboard appears. Add (or change) the windowSoftInputMode flag in your
AndroidManifest.xml:adjustPankeeps the window size constant and just pans the content, so Ebiten’s surfac…