[AC-4015] Change Background Color for WebView Loading White Screen
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2016-07-08T21:14:21.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Sanchi Varma |
Assignee | Shak Hossain |
Created | 2016-07-08T13:52:27.000+0000 |
Updated | 2016-07-11T11:00:59.000+0000 |
Description
When I load a Window with a WebView
i.e.
var win = Titanium.UI.createWindow({
backgroundColor: Alloy.Globals.colors.Yellow
});
var webView = Titanium.UI.createWebView({
url : local_html_file,
backgroundColor : Alloy.Globals.colors.Yellow,
});
win.add(webView);
win.addEventListener('close', function() {
win.removeEventListener('close', function() {});
win.remove(webView);
webView = null;
win = null;
});
win.open();
.
.
.
Now in this case
A yellow background displays for a fraction of second...
then white screen displays for a second until the Window(with webview) loads completely
Then the Window loads With the webview
.
.
I want to change the background of in between shown white screen to Yellow instead.
(From : When window with webview is loaded and webview in over written to window and white screen is shown
To : When WebView is loaded)
How can this be done?
(Please mention any titanium core library file change if required to perform this action for now)
Hey there, see this native answer on it: http://stackoverflow.com/a/6605214/5537752. You can do the same in Titanium, for example by using
webView.setHidden(true); and inside the {{load
event, usewebView.setHidden(false)
. It's a very common way to control the background before the content is loaded. You can also wrap it into a view that has a backgroundColor and hide/show it inside there.Thanks Hans. Although setHidden() was not identified as a valid method, but using "opacity : 0" while defining web view, and "webview.opacity = 1" in "load" event listener did the trick. The issue is resolved now
Sorry, I meant
setVisible(false)
. Great that it works now!Thanks Hans... setVisible(false) works perfect