trigger.io Android webview app - grey background appearing after keyboard closes or orientation change

跟風遠走 提交于 2019-12-13 19:49:43

问题


I'm building an html5 wrapped iOS / Android app with Trigger.io.

I have a problem on Android with a grey background appearing on the screen in some occasions after the virtual keyboard has closed, or after the phone has changed orientation.

Example screenshots are shown below.

The grey background is after the end of my app's page. Sometimes it is visible for a split second, other times it stays visible until you make an action such as scroll the page, bring the keyboard back, change orientation.

It's pretty jarring to look at.

I'd ideally like to stop the issue occurring, but as a temporary fix I'd be happy with being able to set the grey to my own background colour to make it less noticeable.


回答1:


This looks like the HTML's not being re-drawn when the keyboard disappears... does it clear up if you do something to trigger a render?

Are you using a framework to handle the UI here? Something that might be trying to do something clever based on the visible viewport?

From what I can tell, the root of the issue is in the webview not re-drawing correctly, or something in your JavaScript failing to respond to the viewport changing size.

You could try running the app on the "web" target (instead of Android) then opening it in your phone's browser: if you can get far enough into the app to create the same effect it would help isolate the problem to the webview rendering or your JS.




回答2:


I had a very similar issue in my project, in my case on Android 2.3.5 but not on Android 4.*. The cause in my case was not setting a window soft input mode for the associated activity in the manifest:

android:windowSoftInputMode="adjustPan"

Instead, the window was resizing when the keyboard appeared but apparently not resizing once more when the keyboard disappeared.

More details can be found here.




回答3:


I almost went crazy with the same issue. I finally found out that this largely depends on the device you are using. I had a similar problem : Fixed elements (HTML) break after android keyboard dissapears?

And I am also using trigger.io. This doesn't happen with some devices. Could be the particular OS in android or could just be the way the specific device handles the memory latency.

I have looked for this but I go with @jamesbrady in that the HTML doesn't redraw. The problem in trigger is that you cannot edit the

android:windowSoftInputMode="adjustPan"

because the activity tag in the AndroidManifest.xml updates on each run. You would need to build a private module for that.



来源:https://stackoverflow.com/questions/16188539/trigger-io-android-webview-app-grey-background-appearing-after-keyboard-closes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!